1 window
.addEventListener('load', function() {
2 var links
= document
.getElementById("links").children
[0].children
;
3 var home
= document
.getElementsByClassName("home");
4 var menu
= document
.getElementById("menu");
5 var content
= document
.getElementById("content");
6 var menuLoc
= parseInt(getComputedStyle(menu
).getPropertyValue("top"));
8 function menuOperator(position
, token
="") {
9 event
.preventDefault();
10 var node
= event
.currentTarget
;
11 menu
.setAttribute("class", position
);
12 for(var i
= 0; i
< links
.length
; i
++) {
13 links
[i
].children
[0].removeAttribute("class");
15 node
.setAttribute("class", "selected " + token
);
16 for(var i
= 0; i
< content
.children
.length
; i
++) {
17 content
.children
[i
].setAttribute("class", "hidden")
19 var name
= node
.getAttribute("data-name");
21 var article
= document
.getElementById(name
);
22 article
.setAttribute("class", "selected");
24 window
.history
.pushState("object or string", "Title", node
.href
);
27 for(var i
= 0; i
< links
.length
- 1; i
++) {
28 links
[i
].children
[0].onclick = function(event
) {
32 for(var i
= 0; i
< home
.length
; i
++) {
33 home
[i
].onclick = function(event
) {
34 menuOperator("middle", "home");