0
I am using this code to add a class to leave a fixed menu. The problem is that it is not removing the class afterwards. How to proceed?
$(window).on('scroll', function() {
if ($(this).scrollTop() >= $('nav').offset().top) {
$('nav:not(.fixo)').addClass('fixo');
} else {
$('nav.fixo').removeClass('fixo');
}
});
Seems to be working fine: https://jsfiddle.net/zo9x5v8e/
– Miguel
here he adds the class but does not remove, I do not know why
– Otavio Fagundes
would be nice if you also post HTML
– mau humor
it seems that it works but after assigning the fixed class and scrolling the page up there it no longer works, does not recognize the scrollUp ?
– Otavio Fagundes
put a.log console before the line $('Nav.fixed'). removeClass('fixed'); to find out if at least the code has reached there
– Wallace Magalhães
Puts the HTML... pf.
– Sergio