How to add or remove class on window scroll Top

wp nav menu0

Easily you can add or remove class on element when you scroll site with javaScript.

    jQuery(window).scroll(function(){
        if (jQuery(window).scrollTop() > 200){ 
            jQuery('.siteHeader').addClass("stickyNavbar");
        }
        else {
            jQuery('.siteHeader').removeClass("stickyNavbar");
        }
    });

Leave a Reply