I have this code which checkes the top offset and changes the class of the menu accordingly.
It works perfectly, except in IE7 and IE8, where the class is not changed.
This is the code:
$(document).scroll(function(){
if($(document).scrollTop() >= 800) {
$('#menu').removeClass('default').addClass('fixed');
}
else{$('#menu').removeClass('fixed').addClass('default');}
});
If anyone wants to have a look at, link is http://www.vivianzoric.com/esiq/index.html
p.s. Don’t ask me why it falls apart in IE7, i only begin working on this yesterday:)
Try using,
windowinstead ofdocumentBut keep
$(document).scrollTop(function()And just so you know,
.scrollTopdoes work in IE (IE8 anyway)UPDATE
Heres the exact code I currently use on one of my site