Answers for "javascript on scroll change nav color"

1

on scroll change navbar color

$(document).ready(function(){
    $(window).scroll(function(){
        if($(window).scrollTop() > $(window).height()){
            $(".menu").css({"background-color":"transparent"});   
        }
        else{
            $(".menu").css({"background-color":"white"});
        }

    })
})
Posted by: Guest on November-08-2020
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 color on scroll vanilla js

var myNav = document.getElementById("nav");

window.onscroll = function() {
  "use strict";
  if (document.body.scrollTop >= 280 || document.documentElement.scrollTop >= 280) {
    myNav.classList.add("scroll");
  } else {
    myNav.classList.remove("scroll");
  }
};
Posted by: Guest on May-23-2021

Code answers related to "javascript on scroll change nav color"

Code answers related to "Javascript"

Browse Popular Code Answers by Language