-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
28 lines (25 loc) · 798 Bytes
/
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
var slidePosition = 1;
SlideShow(slidePosition);
// forward/Back controls
function plusSlides(n) {
SlideShow(slidePosition += n);
}
// images controls
function currentSlide(n) {
SlideShow(slidePosition = n);
}
function SlideShow(n) {
var i;
var slides = document.getElementsByClassName("containers");
var circles = document.getElementsByClassName("carousel-indicator");
if (n > slides.length) {slidePosition = 1}
if (n < 1) {slidePosition = slides.length}
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
for (i = 0; i < circles.length; i++) {
circles[i].className = circles[i].className.replace("enable", "carousal-indicator");
}
slides[slidePosition-1].style.display = "block";
circles[slidePosition-1].className += " enable";
}