I have a site running some javascript. In IE8 only, the $(document).scroll is not firing when you scroll with or without the mousewheel. Code snippet below:
$(document).scroll(function () {
//do something on scroll
});
Is there a specific reason this function won't fire in IE8? I have searched online with no success.
Thanks for all advice and tips in advance!!!!!
Try using
window
:For a lot of areas, IE ties the event to window rather than document as other browsers will. $(window).scroll(function(e) {}); is what you're after here. Should generally also work in most other browsers too, but if not, use a check on the navigator to find IE and use window or document based on that Boolean.