window.addEventListener('load', function() {
- var menuLoc = 0;
var links = document.getElementById("links").children[0].children;
- var menu = document.getElementById("menu");
- function menuMove(node) {
- if(menuLoc) return;
- menu.setAttribute("class", "top");
- setTimeout(function() { menu.setAttribute("class", "left") }, 600);
- menuLoc = 1;
+ 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]);
}
- for(var i = 0; i < links.length; i++) {
- links[i].onclick = function(node) { menuMove(node); };
+ 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);