-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjs.js
38 lines (32 loc) · 901 Bytes
/
js.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
// images.style.transform = `translateX(-${index * 800}px)`
//
let indice = 1;
muestraSlides(indice);
function avanzaSlide(n){
muestraSlides( indice+=n );
}
function posicionSlide(n){
muestraSlides(indice=n);
}
setInterval(function tiempo(){
muestraSlides(indice+=1)
},4000);
function muestraSlides(n){
let i;
let slides = document.getElementsByClassName('miSlider');
let barras = document.getElementsByClassName('barra');
if(n > slides.length){
indice = 1;
}
if(n < 1){
indice = slides.length;
}
for(i = 0; i < slides.length; i++){
slides[i].style.display = 'none';
}
for(i = 0; i < barras.length; i++){
barras[i].className = barras[i].className.replace(" active", "");
}
slides[indice-1].style.display = 'block';
barras[indice-1].className += ' active';
}