-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
35 lines (30 loc) · 1.05 KB
/
app.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
src = document.querySelector('#sources .content');
function toggle() {
console.log("Entered toggle()");
console.log(src.style.display);
if (src.style.display == 'none') {
src.style.display = 'block';
}
else {
src.style.display = 'none';
}
}
const images = document.querySelectorAll('#second img');
const buttons = document.querySelectorAll('.button');
const links = document.querySelectorAll(".links");
images.forEach(image => image.addEventListener('mouseover', hover));
images.forEach(image => image.addEventListener('mouseout', stopHover));
buttons.forEach(button => button.addEventListener('mouseover', hover));
buttons.forEach(button => button.addEventListener('mouseout', stopHover));
console.log(links);
links.forEach(link => link.addEventListener('click', setToVisited));
function hover(e) {
this.classList.add('hovering');
}
function stopHover(e) {
this.classList.remove('hovering');
}
function setToVisited(e) {
links.forEach(link => link.classList.remove("selected"));
this.classList.add("selected");
}