Jump to content

How to stop the down button from scrolling


Guardian-Mage

Recommended Posts

I have a div with overflow:scroll, and inside that div is a table with about 700 rows. The div height is only 350px. I have it set up so when I press the down button, it will scroll through the rows (like an email program). However, in IE the down button scrolls so fast, the row I have selected is out of view, and in firefox, the down button doesn't scroll fast enough. The easiest solution in my mind is to prevent the down button from scrolling unless the selected row is at the bottom of the viewable area, again like an email program (thinking thunderbird). I can probably figure out everything else, but I don't know how to prevent the down button from scrolling my div.

 

Any ideas?

Link to comment
Share on other sites

I just tested it and it does exactly what you asked in IE, but in Firefox nothing happens. Apparently the onkeydown event won't fire on a div in FireFox. I tried to get around this by setting a dummy variable to tell if the div had focus and then execute the condition after a key was pressed only if the div had focus, but I can't get any function to be recognized through an event on the body tag. If you can figure that part out it will work, but I give up on Firefox. I don't understand why everyone thinks it is so much better than IE when it doesn't even recognize the standards.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.