Scroll div with jquery

Hello,

I have a div with a class of .list.

It is on a nav bar on the right and a couple of the items have a on hover script to show the sub category. Two of the subcategories go farther than the window.

Can you let me know if you know of a jquery solution to this, it would be great if I could get the .list div to scroll up to show more items if the cursor goes 50 or so pixels higher then the bottom of the window.

Thanks!
LVL 1
movieprodwAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
imantasConnect With a Mentor Commented:
Attach mouseover, mousemove handlers, calculate if mouse is at the bottom, then do
var scrollInterval = setInterval(function() { $("elementId").scrollTop++; }, 100);

Open in new window


Just don't forget to catch mouseout or mosemove when it leaves the bottom part and stop scrolling:
clearInterval(scrollInterval)

Open in new window


But as I've mentioned above, element has to have some content hidden and scrollable.
0
 
imantasCommented:
To enable scrolling inside element just add a style "overflow: auto" to the element, but its height must be limited, ie height attribute set to a fixed value.
0
 
movieprodwAuthor Commented:
Yeah I would like to try to do this with jquery so it just scrolls by the mouse being near the bottom of the page
0
 
movieprodwAuthor Commented:
as
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.