Not sure if there\'s another question regarding this, if so I apologize and please don\'t release the hounds.
Using the html5 doctype and doing a quick console.log o
Try to use var scrollTop = $(document).scrollTop();
After some frustration with IE9 in quirks mode, I've found the that $('body').scrollTop()
works reliably in IE9, Chrome 32 and Firefox 26.
$(window).scrollTop()
works as expected in both Firefox and Chrome.
For verification run the following jsfiddle in both chrome and firefox: http://jsfiddle.net/RBBw5/6/
Use var scrollTop = $('html').scrollTop();
works for FireFox
You'll need to sniff the browser out though (I know, feature detect, not sniff, but you can't detect this), because it won't work in Chrome, try here :
Easiest/Lightest Replacement For Browser Detection jQuery 1.9?