-
Notifications
You must be signed in to change notification settings - Fork 1
/
script.js
59 lines (42 loc) · 1.75 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
/* --------- FUNCION CARRUSEL 1 --------- */
const carrusel = document.querySelector(".carrusel__container");
const nxtBtn = document.querySelector(".carrusel__next");
const preBtn = document.querySelector(".carrusel__prev");
nxtBtn.addEventListener("click", () => {
carrusel.scrollLeft += carrusel.offsetWidth;
});
preBtn.addEventListener("click", () => {
carrusel.scrollLeft -= carrusel.offsetWidth;
});
/* --------- FUNCION CARRUSEL 2 --------- */
const carruselS = document.querySelector(".carrusel__container-small");
const nxtBtnS = document.querySelector(".carrusel__next-small");
nxtBtnS.addEventListener("click", () => {
carruselS.scrollLeft += carruselS.offsetWidth;
});
/* --------- FUNCION CARRUSEL 3 --------- */
const carruselTres = document.getElementById("carrusel-3");
const nxtBtnTres = document.getElementById("nxt3");
const preBtnTres = document.getElementById("prev3");
nxtBtnTres.addEventListener("click", () => {
carruselTres.scrollLeft += carruselTres.offsetWidth;
});
preBtnTres.addEventListener("click", () => {
carruselTres.scrollLeft -= carruselTres.offsetWidth;
});
/* --------- FUNCION CARRUSEL 4 --------- */
const carruselS4 = document.getElementById("carruselS4");
const nxtBtnS4 = document.getElementById("nxt4");
nxtBtnS4.addEventListener("click", () => {
carruselS4.scrollLeft += carruselS4.offsetWidth;
});
/* --------- FUNCION El deporte es para todos --------- */
const carruselL = document.querySelector(".carrusel__container-gap-16");
const nxtBtnL = document.getElementById("nxtL");
const preBtnL = document.getElementById("prevL");
nxtBtnL.addEventListener("click", () => {
carruselL.scrollLeft += carruselL.offsetWidth;
});
preBtnL.addEventListener("click", () => {
carruselL.scrollLeft -= carruselL.offsetWidth;
});