Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

sticky navigation bar on scroll

// sticky Header js plugin
let w_out_sticky = document.querySelector(".w-out")// terget class or id
 // hear is  scroll logic
window.addEventListener('scroll', () => {
    window.scrollY > 300 ? w_out_sticky.classList.add("sticky") : w_out_sticky.classList.remove("sticky")
})
Comment

scroll to a section on click on sticky navbar menu html css js

$('html, body').animate({
  scrollTop: $("#section2").offset().top - $("#nav").height() // minus the nav height
}, 1000);
Comment

PREVIOUS NEXT
Code Example
Javascript :: modify array js 
Javascript :: review rating design 
Javascript :: javascript even number 
Javascript :: detect query param route change angular 
Javascript :: angular how to use service in class 
Javascript :: how to parse header in node.js lambda 
Javascript :: How to pass methods in vue js 
Javascript :: how to put dynamic image in react 
Javascript :: json in python 
Javascript :: remove duplicate values from string in javascript 
Javascript :: debug bar laravel unninstall 
Javascript :: apply css to shadow dom 
Javascript :: frames[i] js 
Javascript :: axios send payload in get request 
Javascript :: send request express 
Javascript :: concate array to string javascript 
Javascript :: react native setTimeOut error 
Javascript :: nextjs sitemap generator 
Javascript :: reducer react 
Javascript :: node.js vm 
Javascript :: javascript closures 
Javascript :: use navigation in class component react native drawer navigation 
Javascript :: javascript if return true false 
Javascript :: remove last character from string javascript 
Javascript :: sequelize compare dates in two columns 
Javascript :: index.js:1 You have included the Google Maps JavaScript API multiple times on this page. This may cause unexpected errors. 
Javascript :: ant design form validation in the modal 
Javascript :: delete value from an array javascript 
Javascript :: how to assign dynamic value to variable in javascript 
Javascript :: javascript filter array 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =