Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var navi = document.getElementById("navigation");
- var naviPosY = navi.offsetTop;
- document.addEventListener("scroll", function(e) {
- if (window.scrollY >= naviPosY){
- navi.className ="fixed";
- } else {
- navi.className ="absolute";
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement