-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
82 lines (59 loc) · 2.05 KB
/
index.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
70
71
72
73
74
75
76
77
78
79
80
81
82
const block = document.querySelectorAll('.footerSupMenu__block')
const h5 = document.querySelectorAll('.footerSupMenu__h5')
window.addEventListener('resize', () =>{
if(window.innerWidth > 1600){
for (const h of h5) {
h.removeEventListener('click',accordeon, false)
}
} else {
for (const h of h5) {
h.addEventListener('click',accordeon)
}
}
})
// JS en el nav bar
const button = document.querySelector('.navbar__button')
const nav = document.querySelector('.nav__elements')
const navbar = document.querySelector('.navbar')
const slack = document.querySelector('h5')
const svg = document.querySelector('.navbar__button--svg')
button.addEventListener('click', () =>{
if (nav.classList.toggle('activo')){
navbar.style.background = "#fff";
button.style.background = "#fff";
slack.style.color = "#000";
svg.style.filter="invert(100%)"
}
else {
navbar.style.background = "#531554";
button.style.background = "#531554";
slack.style.color = "#fff";
svg.style.filter="invert(0%)"
}
})
// JS para el carrusel
const caption = document.querySelector('.addFeatures__caption')
const span = document.querySelectorAll('.addFeatures__carrusel--span')
span.forEach((cadaSpan, i) =>{
span[i].addEventListener('click', () =>{
let position = i
let operacion = position * -170
caption.style.transform = `translateX(${operacion}%)`
span.forEach( (cadaSpan, i) => {
span[i].classList.remove('span__active')
})
span[i].classList.add('span__active')
})
})
//JS para el acordeón
const accordeon = (e) => {
const i = e.target.id
block.forEach((eachBlock, i)=>{
eachBlock.classList.remove('block--active')
})
block[i].classList.add('block--active')
}
h5.forEach(( eachH5, i) =>{
eachH5.id = i
h5[i].addEventListener('click', accordeon
)})