change header background color on scroll css

Solutions on MaxInterview for change header background color on scroll css by the best coders in the world

showing results for - "change header background color on scroll css"
Aleah
15 Nov 2016
1/* 
2    .active { background-color: #fff}
3*/
4$(function() {
5    $(window).on("scroll", function() {
6        if($(window).scrollTop() > 50) {
7            $(".header").addClass("active");
8        } else {
9           $(".header").removeClass("active");
10        }
11    });
12});