Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- window.onscroll = function() {myFunction()};
- var stickymenuparent = document.getElementById("stickymenuparent");
- var sticky = stickymenuparent.offsetTop;
- function myFunction() {
- if (window.pageYOffset >= sticky) {
- stickymenuparent.classList.add("sticky")
- } else {
- stickymenuparent.classList.remove("sticky");
- }
- }
Add Comment
Please, Sign In to add comment