var position = $('body').scrollTop() on mozilla does not update the scrolled value, commit changes selector $('body') to $(window) - and scrollTop function works now.