开发者

Scrolling in JQuery

I want to scroll to a div + 100px in the y axis.

How开发者_高级运维 do I do that?

$.scrollTo('div100' + '100px', 2000) doesn't work.


Assuming you mean the ScrollTo plugin, the documentation says you can pass some settings as the third argument, one of which can be offset. So I guess something like this could work:

$.scrollTo('div100', 2000, { offset: { left: 0, top: 100 } });


I haven't tested this but should work

var element=$("#div100");

$(...).scrollTo( element.offset().left, element.offset().top + 100);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜