-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
59 lines (45 loc) · 1.35 KB
/
script.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
const imagens = document.querySelectorAll(".image-item");
function imageHover(event){
event.currentTarget.classList.toggle('hover-image');
}
const opitions = document.querySelectorAll('.image-container div');
const infos = document.querySelectorAll('.result-container div');
function activeTab(index){
infos.forEach((content) => {
content.classList.remove("ativo");
})
infos[index].classList.add("ativo");
}
function menuClickedHandler(event){
event.currentTarget.classList.add('clicked-image');
}
const links = document.querySelectorAll('.image-item a');
function linkHover(event){
const windowHeight = document.body.offsetWidth;
if (windowHeight < 1218) {
links.forEach((content) => {
content.setAttribute('href', '#result');
})
}else{
links.forEach((content) => {
content.removeAttribute('href');
})
}
}
links.forEach((link) => {
link.addEventListener('mouseover', linkHover)
})
opitions.forEach((itemMenu, index) => {
itemMenu.addEventListener('click', () => {
activeTab(index);
})
})
opitions.forEach((itemMenu) => {
itemMenu.addEventListener('click', menuClickedHandler)
})
imagens.forEach((img) => {
img.addEventListener('mouseover', imageHover)
})
imagens.forEach((img) => {
img.addEventListener('mouseout', imageHover)
})