Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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");
  }
};
Comment

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"});
        }

    })
})
Comment

javascript on scroll change nav color

$(function () {
  $(document).scroll(function () {
    var $nav = $(".navbar-fixed-top");
    $nav.toggleClass('scrolled', $(this).scrollTop() > $nav.height());
  });
});
Comment

change nav color on scroll vanilla js

if (document.body.scrollTop >= 280 || document.documentElement.scrollTop >= 280) {
Comment

PREVIOUS NEXT
Code Example
Javascript :: react native get location 
Javascript :: formik seterrors 
Javascript :: post to /wp-json/wp/v2/media 
Javascript :: child_process npm 
Javascript :: javascript uppercase function 
Javascript :: npm get package.json version 
Javascript :: regex scan youtube video id 
Javascript :: vuetify open modal based on url anchor or # 
Javascript :: mongodb check if collection exists 
Javascript :: regex 
Javascript :: circular queue implementation using js 
Javascript :: curl send json as variable 
Javascript :: render twice react 
Javascript :: ANGULAR locale fr 
Javascript :: open youtube video at specific time javascript 
Javascript :: import tippy react 
Javascript :: initialize a map js 
Javascript :: Class constructor cannot be invoked without new 
Javascript :: javascript await return value 
Javascript :: email validation node js 
Javascript :: reactjs navbar component 
Javascript :: Object.values returns 
Javascript :: nuxt auth keep user loggedin on refresh 
Javascript :: js sort integer array 
Javascript :: { use UnifiedTopology: true } 
Javascript :: javascript perform click 
Javascript :: appendchild on specific position 
Javascript :: popper.js and jquery 
Javascript :: function that duplicates data in array js 
Javascript :: angular cli no test 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =