Answers for "change nav background color on scroll css without bootstrap"

CSS
1

javascript on scroll change nav color

$(function () {
  $(document).scroll(function () {
    var $nav = $(".navbar-fixed-top");
    $nav.toggleClass('scrolled', $(this).scrollTop() > $nav.height());
  });
});
Posted by: Guest on July-14-2020
0

change nav background color on scroll css without bootstrap

<script>
  $(document).ready(function()
  $(window).scroll(function(){
   var scroll = $(window).scrollTop();
     if(scroll>50){
      $("#nav").css("background", "#555");
       }
       else {
      $("#nav").css("background", "transparent");
       }
      })
   })
</script>
Posted by: Guest on December-05-2020

Code answers related to "change nav background color on scroll css without bootstrap"

Browse Popular Code Answers by Language