-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
53 lines (43 loc) · 978 Bytes
/
script.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// This is the slide mechanism
/*
First
I get the images with one var that call the elements by tag name
R= bannerImages = [li, li, li, li, li];
*/
var bannerImages = document.getElementsByTagName("li");
var index = 0;
document.addEventListener('DOMContentLoaded' , function(){
bannerImages[0].classList.add('go-visible');
});
function loopPlus(){
removeClass();
index = index + 1;
if(index < bannerImages.length){
addClass();
} else {
index = 0;
addClass();
}
}
function loopLess(){
removeClass();
index = index - 1;
if(index < bannerImages.length && index >= 0){
addClass();
} else {
index = bannerImages.length - 1;
addClass();
}
}
function addClass(){
bannerImages[index].classList.add('go-visible');
}
function removeClass(){
bannerImages[index].classList.remove('go-visible');
}
/*
for (var i = 0; i < bannerImages.length; i++){
bannerImages[i].classList.add('change-display');
console.log("ready");
}
*/