jQuery stickyscroll cant add offset from top

raneez

New Member
I am currently using this \[code\]jQuery plugin\[/code\] and i need to set offset 20 px offset from top.So i figured out how to add offset as option when i initialize this plugin..... and after that i added a little code to the \[code\]onscroll\[/code\] method and now it looks like this\[code\]var hor = new Number(0); //offset if(settings.fail!=null) hor = new Number(settings.fail); var top = $(document).scrollTop(), bottom = $(document).height() - top - height; if(bottom <= settings.bottomBoundary) { el.offset({ top: $(document).height() - settings.bottomBoundary - height }) .removeClass('sticky-active') .removeClass('sticky-inactive') .addClass('sticky-stopped'); } else if(top > settings.topBoundary) { var scrollTop = $(window).scrollTop()+hor; //heres what i think causes problem el.offset({ top: scrollTop }) .removeClass('sticky-stopped') .removeClass('sticky-inactive') .addClass('sticky-active'); } else if(top < settings.topBoundary) { el.css({ position: '', top: '', bottom: '' })\[/code\]So the problem is when i scroll the selected element offset from top will increase until it is invisible.What should i do to fix this?Thank you already!
 
Back
Top