-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
36 lines (35 loc) · 952 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
alert("heyeveryone ")
let contestposition = 0;
const contests = document.getElementsByClassName('smboxes');
const totalcontest = contests.length;
document.
getElementById('contest__actions--prev').
addEventListener("click", function(){movetoPrevcontest();
});
document.
getElementById('contest__actions--next').
addEventListener("click", function(){movetoNextcontest();
});
function updatecontest(){
for(let contest of contests){
contest.classList.remove('smboxes--visible');
contest.classList.add('smboxes--hidden');
}
contests[contestposition].classList.add('smboxes--visible')
}
function movetoNextcontest(){
if(contestposition == totalcontest-1 ){
contestposition =0;
} else {
contestposition++;
}
updatecontest();
}
function movetoPrevcontest(){
if(contestposition == 0){
contestposition = totalcontest -1;
} else {
contestposition--;
}
updatecontest();
}