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

m
m
Line 9: Line 9:
 
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
 
var navItems = document.getElementsByClassName("nav-item"); // gets all of the nav-items
 +
varFoodItems = document.getElementsByClassName("food-item-inner");
  
 
function openNav() {
 
function openNav() {
Line 52: Line 53:
 
     for(i = 0; i < dropLinks.length; i++) { // then adds the class name active-menu to a specified element
 
     for(i = 0; i < dropLinks.length; i++) { // then adds the class name active-menu to a specified element
 
         if(i == (x-1)) {
 
         if(i == (x-1)) {
             dropLinks[i].className = "drop-link nav-item active-menu"
+
             dropLinks[i].className = "drop-link nav-item active-menu";
 
         }
 
         }
 +
    }
 +
}
 +
 +
function flipFood(x) {
 +
    unFlipFood();
 +
 +
    for(i = 0; i < foodItems.length; i++) {
 +
        if(i == (x-1)) {
 +
            foodItems[i].className = "food-item-inner flipped-food-item-inner";
 +
        }
 +
    }
 +
}
 +
 +
function unFlipFood() {
 +
    for(i = 0; i < foodItems.length; i++) {
 +
        foodItems[i].className = "food-item-inner";
 
     }
 
     }
 
}
 
}

Revision as of 14:41, 19 June 2020