Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

change header background color on scroll css

/* 
    .active { background-color: #fff}
*/
$(function() {
    $(window).on("scroll", function() {
        if($(window).scrollTop() > 50) {
            $(".header").addClass("active");
        } else {
           $(".header").removeClass("active");
        }
    });
});
 
PREVIOUS NEXT
Tagged: #change #header #background #color #scroll #css
ADD COMMENT
Topic
Name
3+5 =