-1

I have a position:fixed; menu on top of my page with a height of 175px. I used the code from scrollTo but the scroll effect puts the chosen container on the top of the page, behind my menu.

How can I assign margin-top: 175px; to the scrollTo code, so it shows up underneath the menu <div>?

JSfiddle

gvlasov
  • 18,638
  • 21
  • 74
  • 110
Mr.ZZ
  • 340
  • 3
  • 16

1 Answers1

2

You can use the offset option of jQuery.scrollTo, e.g.

$.scrollTo(scroll, {
    duration: 500,
    axis: 'y',
    offset: {top: -175, left: 0}
});

In your particular case you'll have to make some calculations in your scroll() function as well.

Check this JSFiddle

dekkard
  • 6,121
  • 1
  • 16
  • 26