-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
27 lines (25 loc) · 711 Bytes
/
index.js
File metadata and controls
27 lines (25 loc) · 711 Bytes
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
var currentSlide = 0;
function changeSlide(direction) {
if (direction == 1) {
getSlide(currentSlide).style.display = "none";
getSlide(++currentSlide).style.display = "block";
} else {
getSlide(currentSlide).style.display = "none";
getSlide(--currentSlide).style.display = "block";
}
}
function getSlide(n) {
array = document.getElementsByClassName("slide");
if (!array.length > 1) {
return array[0];
}
if (n == array.length) {
currentSlide = 0
return array[currentSlide];
}
if (n == -1) {
currentSlide = array.length-1
return array[currentSlide];
}
return array[n];
}