ABooooo
7/6/2017 - 9:58 AM

Change CSS on scroll

Change CSS on scroll

var scroll_pos = 0;
    $(document).scroll(function() {
        scroll_pos = $(this).scrollTop();
        if(scroll_pos > 210) {
            $(".navbar-default").css({"background-color": "black" , "padding-top" : 0});
        } else {
            $(".navbar-default").css({"background-color" : "transparent" , "padding-top" : "30px"});
        }
    });