Problem with keyboard control
I'm working on the div class of blocks to control them using the keyboard up and down arrow buttons. I have the list of blocks where 7 of them are showing while the other blocks are hiding. I have text of blocks from block 1 to block 17. When I press on the down arrow button from block 1 to block 17, the blocks will move up using 'rowheight' which it looks good to go, but there is a problem. When I press on the up arrow button and the down arrow button after the block 7, the blocks supposed to stay where they are but it will move up when the yellow block is on the block 8, block 9, block 10, block 11, block 12, block 13, block 14, block 15, block 16 and block 17.
I think the problem are somewhere in this code:
In this case, when I press on the down arrow button from block 1 to block 7 and if I press on the up arrow button, the blocks will not move up where it stays on. When I press on the down arrow button after the block 7, if I press on the up arrow button and then the down arrow button, the blocks will move up. The same things that goes for other blocks. I want the blocks to move up only when I'm after the end of the block where the blocks are hiding, e.g.: I'm on the block 7 while the other blocks after the block 7 are hiding so I can move them up. I don't want to move the blocks up when I'm not the end of the block.
if (event.keyCode == 40)
if(current_col < totalrowcount && current_row == 1)
if(current_col >= displayrowcount)
var currentrowtop = $(".mainWrap div.row:first-child").css( "margin-top");
currentrowtop = parseInt(currentrowtop)-rowheight;
var rowtop = currentrowtop+="px";
$(".mainWrap div.row:first-child").css( "margin-top", rowtop );
Does anyone know how I can block the blocks from move up when I'm not after the end of the block while the other blocks are hiding?
Here's my example site if you need to take a look: http://testbox.elementfx.com/blocks.php
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)