开发者

Scroll to newly added element

How do I automatically scroll to a new开发者_开发问答ly .append()ed element after clicking a button?


Flesler's scrollTo plugin should do what you want.

$().scrollTo( $('div li:eq(14)'), 800 );

or if you provide a context..

$('.pane').scrollTo('div li:eq(14)')

More examples @ http://demos.flesler.com/jquery/scrollTo/


Animated smooth scroll using a jQuery .scrollintoview plugin

Visible scrolling is especially essential when there will be more than a pagefull of scrolling. Simply jumping to the element will pose a usability issue and may confuse users. Animation will not because they will know exactly where they are.

$("<div>Testung</div>").appendTo("#SomeContainer").scrollintoview();

You will find this plugin here:

http://erraticdev.blogspot.com/2011/02/jquery-scroll-into-view-plugin-with.html

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜