Difference between revisions of "Template:British Columbia/Header"

Line 67: Line 67:
 
window.onscroll = function() {myFunction()};
 
window.onscroll = function() {myFunction()};
  
var navbar = document.getElementById("navbar");
+
var dropdown = document.getElementById("dropdown");
var sticky = navbar.offsetTop;
+
var sticky = dropdown.offsetTop;
  
 
function myFunction() {
 
function myFunction() {
 
   if (window.pageYOffset >= sticky) {
 
   if (window.pageYOffset >= sticky) {
     navbar.classList.add("sticky")
+
     dropdown.classList.add("sticky")
 
   } else {
 
   } else {
     navbar.classList.remove("sticky");
+
     dropdown.classList.remove("sticky");
 
   }
 
   }
 
}
 
}

Revision as of 04:48, 20 August 2018