I need to toggle the class .hidden to my sticky menu when either the #pre-footer or #footer div is visible in the window.
I've been messing with jquery and scrollTop(); but can't seem to get it going. Any help would be appreciated
$(document).ready(function() {
var $window = $(window);
var tabwrap = $('.tab-wrap');
var prefooter = $('#pre-footer');
$window.on('scroll', function() {
var scrollTop = $window.scrollTop();
tabwrap.toggleClass('hidden', scrollTop > 300); /* Help! */
/* .tabwrap should toggle class .hidden when #pre-footer and or #footer is visible in window */
});
});
Fiddle so far: https://jsfiddle.net/gavinfriel/4tcjnoxp/5/