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)'); } });
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.
Thank you for your comment. It was very helpful to me.
is there a solution to ZSHARE’s question?
Can I change without any custom code mean only by bootstrap or jquery.
Hello Max, this custom code is written in jQuery.
Did I have to call this jQuery function in my navbar with Onclick
Hello Hanniel,
You can write this code in your child theme footer.php file, custom js file in your theme.