views:

138

answers:

2

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

How do I do that?

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

+2  A: 

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 } });
Lukáš Lalinský
A: 

I haven't tested this but should work

var element=$("#div100");

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