javascriptjqueryhtmlcsstwitter-bootstrap-4-beta

How can i change color of top fixed navbar in bootsrap 4?


Hi I am new to web development. I have a problem with navbar in bootstrap 4 beta while changing the color. How can I change the color of a fixed navigation bar while scrolling in bootstrap 4 beta. And please consider any tutorial about this.


Solution

  • i given some idea,just this is an example,

    $(document).ready(function(){
      $(window).scroll(function(){
      	var scroll = $(window).scrollTop();
    	  if (scroll > 300) {
    	    $(".black").css("background" , "blue");
    	  }
    
    	  else{
    		  $(".black").css("background" , "#333");  	
    	  }
      })
    })
    body{
      margin:0;
      padding:0;
      height:1000px;
    }
    .black{
      position:fixed;
      top:0;
      background:#333;
      width:100%;
      height:50px;
      
    }
    .black ul{
      list-style-type:none;
      padding:0;
    }
    
    .black ul li{
      display:inline-block;
      width:100px;
      color:red;
    }
    
    .blue{
      position:fixed;
      top:0;
      background:blue;
      width:100%;
      height:50px;
    }
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <div class="black">
      <ul>
        <li>link</li>
        <li>link</li>
        <li>link</li>
        <li>link</li>
      </ul>
    </div>