You can add or remove the .transparent class in nav according to the position of the scroll bar.
$(window).scroll(function() { if ($(document).scrollTop() > 50) { $('nav').addClass('transparent'); } else { $('nav').removeClass('transparent'); } });
and CSS:
nav.navbar{ -webkit-transition: all 0.4s ease; transition: all 0.4s ease; } nav.navbar-inverse { background-color: #222; border-color: #080808; } nav.navbar.transparent { background-color:rgba(0,0,0,0); }
Here is the solution with your code: http://jsfiddle.net/m7yww8oa/157/
Kaan Burak Sener
source share