Each time I scroll I have many errors on this code, where position is null
var position = $j('.sticky-menu').offset(); $j(window).scroll(function () { var scroll = $j(window).scrollTop() + 108; if (scroll >= position.top) { $j('.sticky-menu').addClass('fixed'); } else { $j('.sticky-menu').removeClass('fixed'); } });