I'm using some code that I found in the K2 theme for WordPress. function smartPosition(obj) { // Detect if content is being scroll offscreen. if ( (document.documentElement.scrollTop || document.body.scrollTop) >= jQuery(obj).offset().top) { jQuery('body').addClass('smartposition'); } else { jQuery('body').removeClass('smartposition'); } }
It's supposed to add and remove the `smartposition` class when the scrolling threshold is right. It works perfectly in K2. I have the style body.smartposition #post-navigation { background:#FFFFFF none repeat scroll 0% 0%; border-bottom:1px solid #EEEEEE; margin:0pt; padding:10px 0pt; position:fixed; top:0px; z-index:10; } In my stylesheet, but the problem is that the class isn't removing!