-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
36 lines (31 loc) · 826 Bytes
/
main.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
var slideIndex = 0;
carousel();
/*Slideshow */
function carousel() {
var i;
var x = document.getElementsByClassName("mySlides");
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
slideIndex++;
if (slideIndex > x.length) {slideIndex = 1}
x[slideIndex-1].style.display = "block";
setTimeout(carousel, 3000); // Change image every 3 seconds
}
var slideIndex = 1;
showDivs(slideIndex);
/*Prev and Next buttons */
function plusDivs(n) {
showDivs(slideIndex += n);
}
/*Prev and Next buttons */
function showDivs(n) {
var i;
var x = document.getElementsByClassName("mySlides");
if (n > x.length) {slideIndex = 1}
if (n < 1) {slideIndex = x.length}
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
x[slideIndex-1].style.display = "block";
}