Difference between revisions of "Template:Queens Canada/Scripts"

m
m
Line 8: Line 8:
 
var navText = document.getElementsByClassName("nav-text"); // gets all nav-text elements bc they are used in multiple funcs
 
var navText = document.getElementsByClassName("nav-text"); // gets all nav-text elements bc they are used in multiple funcs
 
var dropLinks = document.getElementsByClassName("drop-link"); // gets all of the expandable nav sections for the same reason
 
var dropLinks = document.getElementsByClassName("drop-link"); // gets all of the expandable nav sections for the same reason
 +
var navItems = document.getElementsByClassName("nav-item"); // gets all of the nav-items
  
 
function openNav() {
 
function openNav() {
Line 15: Line 16:
 
         for(i = 0; i < navText.length; i++) { // makes the text inside each nav-item visible  
 
         for(i = 0; i < navText.length; i++) { // makes the text inside each nav-item visible  
 
             navText[i].style.opacity = "1";
 
             navText[i].style.opacity = "1";
 +
            navItems[i].style.pointer-events = "all"; // gives back the ability to click on things when the nav is open
 
         }  
 
         }  
 
     }, 500);     
 
     }, 500);     
Line 28: Line 30:
 
     for(i = 0; i < navText.length; i++) {
 
     for(i = 0; i < navText.length; i++) {
 
         navText[i].style.opacity = "0";
 
         navText[i].style.opacity = "0";
 +
        navItems[i].style.pointer-events = "none"; // tries to hide the fact that you can still click on it when closed
 
     }
 
     }
  

Revision as of 14:56, 15 June 2020