-
Notifications
You must be signed in to change notification settings - Fork 0
/
technology-capsule.js
47 lines (46 loc) · 2.52 KB
/
technology-capsule.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
let elem_home = document.querySelector("nav div ul li.home")
let elem_dest = document.querySelector("nav div ul li.dest")
let elem_crew = document.querySelector("nav div ul li.crew")
let elem_tech = document.querySelector("nav div ul li.tech")
elem_home.addEventListener("mouseover",()=>{
document.querySelector(".effectLineHome").classList.add('activeEffectLine');
})
elem_home.addEventListener("mouseout",()=>{
document.querySelector(".effectLineHome").classList.remove('activeEffectLine')
})
elem_dest.addEventListener("mouseover",()=>{
document.querySelector(".effectLineDest").classList.add('activeEffectLine');
})
elem_dest.addEventListener("mouseout",()=>{
document.querySelector(".effectLineDest").classList.remove('activeEffectLine')
})
elem_crew.addEventListener("mouseover",()=>{
document.querySelector(".effectLineCrew").classList.add('activeEffectLine');
})
elem_crew.addEventListener("mouseout",()=>{
document.querySelector(".effectLineCrew").classList.remove('activeEffectLine')
})
// elem_tech.addEventListener("mouseover",()=>{
// document.querySelector(".effectLineTech").classList.add('activeEffectLine');
// })
// elem_tech.addEventListener("mouseout",()=>{
// document.querySelector(".effectLineTech").classList.remove('activeEffectLine')
// })
document.addEventListener("keydown",(event)=>{
let visibilityVehicleTech = getComputedStyle(document.getElementById("vehicleTech"))['visibility'];
let visibilitySpaceportTech = getComputedStyle(document.getElementById("spaceportTech"))['visibility'];
let visibilityCapsuleTech = getComputedStyle(document.getElementById("capsuleTech"))['visibility'];
if(event.key=='ArrowDown' && visibilityVehicleTech=='visible'){
document.getElementById("vehicleTech").style.visibility = 'hidden';
document.getElementById("spaceportTech").style.visibility = 'visible';
} else if(event.key=='ArrowDown' && visibilitySpaceportTech=='visible'){
document.getElementById("spaceportTech").style.visibility = 'hidden';
document.getElementById("capsuleTech").style.visibility = 'visible';
} else if(event.key=='ArrowUp' && visibilityCapsuleTech=='visible'){
document.getElementById("capsuleTech").style.visibility = 'hidden';
document.getElementById("spaceportTech").style.visibility = 'visible';
} else if(event.key=='ArrowUp' && visibilitySpaceportTech=='visible'){
document.getElementById("spaceportTech").style.visibility = 'hidden';
document.getElementById("vehicleTech").style.visibility = 'visible';
}
})