-
Notifications
You must be signed in to change notification settings - Fork 1
/
slidesjs.js
29 lines (26 loc) · 926 Bytes
/
slidesjs.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
var slideIndex = 1;
showSlides(slideIndex);
function plusSlides(n) {
showSlides(slideIndex += n);
}
function currentSlide(n) {
showSlides(slideIndex = n);
}
function showSlides(n) {
var i;
var slides = document.getElementsByClassName("mySlides"); /* valitakse õige slaid klassi nime järgi, slaididel indeksid ja nende järgi ka punktid.*/
var dots = document.getElementsByClassName("dot");
if (n > slides.length) {slideIndex = 1}
if (n < 1) {slideIndex = slides.length}
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" active", "");
}
slides[slideIndex-1].style.display = "block";
dots[slideIndex-1].className += " active";
}
/* funktsioon, mis teeb slideshow
/* koodi kirjutamisel sain abi lehelt https://www.w3schools.com/howto/howto_js_quotes_slideshow.asp
*/