I wanted to make it so that the header stops moving when the user scrolls past the sliders on the top of the page, so I've used bootstrap affix to change the class. The problem is, the wordpress theme I'm using(zerif lite) has a pre-loader and it only sets the height after it's gone(otherwise it's set to 0, since it hides the slides div). So, since the site is responsive, I've decided that it would just be better to change the affix top parameter when the slides div height is changed, since it will go from 0 to x whenever the preloader, so I've used this code:
jQuery(document).ready(function(){
jQuery("#main-nav").affix({
offset: {
top: jQuery(".sliders").height()
}
});
jQuery(jQuery(".sliders").height()).on('change',function(){
alert('ayy');
});
jQuery('.sliders').on('resize', function(){
alert(jQuery(".sliders").height());
});
});
The current event function is set to that so that I know if it's working, but it's not, and with the click event I can see that it's actually changing.