cmpolis/scrollIt.js

how to use scrollIt.js in different pages with different topOffset?

Opened this issue · 1 comments

It's very nice plugin!! And it works well!!

My issue here:

I've successfully set the topOffset to -160, however on another page i'm calling the same function but i want the topOffest to be 0..

Anyone help please!

Solve it myself by doing this:

if( $(".main-body").hasClass("home-vertical-scroll") ){
var scrollItTopOffset = 0;
}

else{
var scrollItTopOffset = -160;
};

$(function(){
$.scrollIt({
upKey: 38,
downKey: 40,
easing: 'linear',
scrollTime: 600,
onPageChange: null,
topOffset: scrollItTopOffset
});
});