I have a link which animates some div
's height when its hovered, but the div
has a big height
and it goes beyond the visible bottom-end of the screen.
I have to scroll to see the data an开发者_StackOverflowd when I scroll I leave the hover area and the div toggles it's height
to 0px
.
How to automatically scroll to the end of the div
when it toggles?
Try setting the DIV's scrollTop property to it's height, e.g.:
$("#theDiv").mouseover(function() {
$(this).scrollTop($(this).height());
});
You can modify the scrollTop
property of the body:
// Scroll all the way to the bottom
document.body.scrollTop = document.body.scrollHeight;
精彩评论