when we use scroll down nav bar background color change in bootstrap code example
Example: javascript on scroll change nav color
$(function () {
$(document).scroll(function () {
var $nav = $(".navbar-fixed-top");
$nav.toggleClass('scrolled', $(this).scrollTop() > $nav.height());
});
});