| |

Bootstrap 4 – changes fixed-top Navbar background color on scrolling

// navbar background color change on scroll

    $(window).scroll(function(){
        var scroll = $(window).scrollTop();
        if(scroll < 300){
            $('.fixed-top').css('background', 'transparent');
        } else{
            $('.fixed-top').css('background', 'rgba(23, 162, 184, 0.9)');
        }
    });

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

7 Comments

  1. Your solution is not complete. If i scroll the page down and i refresh the page, the navbar will appear only after i scroll the page, and not after refresh.