I just have a general question about debouncing. I have three menus at different positions on the page that when they reach a position 85px from the top of the window on scr
I would say, rather than trying to set the css directly, take advantage of classes.
.fixed_heading_shop,
.fixed_heading_pricetable {
position:relative;
top:0;
}
.ghost_div0,
.ghost_div1 {
display:block;
}
.scroll_trick .fixed_heading_shop,
.scroll_trick .fixed_heading_pricetable {
position:fixed;
top:85px;
}
.scroll_trick .ghost_div0,
.scroll_trick .ghost_div1 {
display:none;
}
$(function(){
var $window = $(window);
var $body = $('body');
var top = $('.fixed_heading_shop').offset().top-85;
$window.scroll(function(){
if( $window.scrollTop() > top) {
$body.addClass('scroll_trick');
} else {
$body.removeClass('scroll_trick');
}
});
});