User:The Master of Hedgehogs/timeless.js

// When the user scrolls the page, execute myFunction window.onscroll = function {myFunction};

// Get the header var headerContainer = document.getElementById("mw-header-container");

var header = document.getElementById("mw-header");

// Get the offset position of the navbar var sticky = headerContainer.offsetTop;

// Add the sticky class to the header when you reach its scroll position. Remove "sticky" when you leave the scroll position function myFunction { if (window.pageYOffset > sticky) { // headerContainer.removeChild(header); headerContainer.style.display = "None"; } else { headerContainer.style.display = ""; } }