Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript window scroll javascript error Re: window scroll javascript error

#134947
pixelgrid
Participant

the scroll event fires multiple times durring a scroll thats why the many errors
try

$window.scroll(function() {
var offset = $(“.navigation-timeline”).offset();
if ($window.scrollTop() > offset.top) {
$sidebar.stop().animate({
marginTop: $window.scrollTop() – offset.top + topPadding
});
} else {
$sidebar.stop().animate({
marginTop: 0
});
}……(rest of code)