-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
69 lines (61 loc) · 2.09 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// TRANSITIONS BETWEEN PAGES
const sPath = window.location.pathname;
const sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
const content = document.querySelector(".content");
const buttons = document.getElementsByClassName("navbar-link");
const contact = document.getElementById("contact-link");
contact.addEventListener("click", ()=>{
if((sPage == "index.html" || sPage == "")) {
window.location.href = 'pages/contact.php';
}else{
window.location.href = 'contact.php';
}
});
document.addEventListener("DOMContentLoaded",()=>{
setTimeout(function(){
content.classList.remove("hidden");
content.classList.add("is-ready");
});
},100);
Array.from(buttons).forEach(button=>{
button.addEventListener("click",()=>{
content.classList.remove("is-ready");
content.classList.add("remove");
setTimeout(function(){
if((sPage == "index.html" || sPage == "") && button.id == "index" ) {
window.location.href = button.id +'.html';
}else if((sPage == "index.html" || sPage == "")){
window.location.href = "pages/" + button.id + '.html';
}else{
if(button.id == "index"){
window.location.href = "../" + button.id +'.html';
}else{
window.location.href = button.id +'.html';
}
}
},500);
});
});
// WORK LIST
const projects = document.getElementsByClassName("project-list");
Array.from(projects).forEach(proj=>{
proj.addEventListener("click",()=>{
console.log(proj);
Array.from(projects).forEach(proj2=>{
proj2.children[0].children[0].style.display = "none";
proj2.children[1].classList.remove("is-ready-work");
proj2.children[1].classList.add("hidden-work");
proj2.children[1].style.height = "0";
proj2.style.margin = "0";
});
proj.children[0].children[0].style.display = "block";
proj.children[1].classList.remove("hidden-work");
proj.children[1].classList.add("is-ready-work");
proj.children[1].style.height = "auto";
if (proj.id == "video"){
proj.style.margin = "10em 0 0";
} else {
proj.style.margin = "10em 0";
}
});
});