scrollTop() returns 0 in Firefox, but not in Chrome
Try to use var scrollTop = $(document).scrollTop();
Try to use var scrollTop = $(document).scrollTop();
They refer to the same element, the difference is that when you say document.body you are passing the element directly to jQuery. Alternatively, when you pass the string ‘body’, the jQuery selector engine has to interpret the string to figure out what element(s) it refers to. In practice either will get the job done. If … Read more