- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfuncion.js
More file actions
Latest commit
19 lines (16 loc) · 463 Bytes
/
Copy pathfuncion.js
File metadata and controls
19 lines (16 loc) · 463 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
letcurrent=0;
constslides=document.querySelectorAll('.mySlides');
consttotal=slides.length;
functionshowSlide(index){
slides.forEach((slide,i)=>{
slide.classList.toggle('active',i===index);
});
}
document.getElementById('next').onclick=function(){
current=(current+1)%total;
showSlide(current);
};
document.getElementById('prev').onclick=function(){
current=(current-1+total)%total;
showSlide(current);
};