15

I am using the jQuery scrollTo plugin as you can see on the page which I'm building http://portfolio.tomvervoort.net/

Because of the 300px fixed header the content moves under the header. You can see this clearly when you click the about button in the menu. Is it possible to add an 300px offset to the scrollTo script so everything stays positioned under the header/menu?

Tom
  • 193
  • 2
  • 2
  • 9

2 Answers2

21

You can use the "offset" setting as described on:

http://flesler.blogspot.com.ar/2007/10/jqueryscrollto.html

Something like:

$.scrollTo(newLoc, o.scrollSpeed, {
     // ...
     offset:-300
});
Ariel Flesler
  • 612
  • 1
  • 4
  • 13
20

You could try changing this line in jquery.nav.js:

$.scrollTo(newLoc, o.scrollSpeed, {

to

$.scrollTo($('newLoc').offset().top-300, o.scrollSpeed, { 

So instead of telling scrollto to scroll to exactly that element, you get the position of the element yourself and subtract 300

Andy
  • 29,707
  • 9
  • 41
  • 58