开发者

Scrolling dynamically to the end of the page

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;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜