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:
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
Hmm, not sure I entirely follow your code (current_col presumably refers to the current row?), but it seems like you need another piece of info to decide whether to scroll or not, which is whether the block that's moved to is already visible or not.
You could write something to work this out each time, but I think I'd tackle this by assigning a 'visible' class to each visible block, and amending this after each scroll event. Then when a keypress indicates a move to a new block you can just check whether that block is already visible (in which case no scroll needed) or whether it's not.
Don't know if that helps....
|All times are GMT +1. The time now is 09:26 AM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.