updates to structure, css, js
[jkinsey.net.git] / js / script.js
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..c5f2c7a4167db351e8af42da240d9cb2ea965c72 100644 (file)
@@ -0,0 +1,27 @@
+window.addEventListener('load', function() {
+    var links = document.getElementById("links").children[0].children;
+    var home = document.getElementsByClassName("home");
+    var directions = [];
+    for(var i = 0; i < links.length - 1; i++) {
+        directions.push(links[i]);
+    }
+    for(var i = 0; i < home.length; i++) {
+        directions.push(home[i]);
+    }
+    var menu = document.getElementById("menu");
+    var menuLoc = parseInt(getComputedStyle(menu).getPropertyValue("top"));
+
+    for(var i = 0; i < directions.length; i++) {
+        directions[i].children[0].onclick = function(event) { 
+            event.preventDefault();
+            var node = event.currentTarget;
+            if(menuLoc != 10) {
+                menuLoc = 0;
+                menu.setAttribute("class", "top");
+                window.history.pushState("object or string", "Title", node.href);
+            } else {
+                window.history.pushState("object or string", "Title", node.href);
+            }
+        };
+    }
+}, false);