28 lines
537 B
JavaScript
28 lines
537 B
JavaScript
let slideIndex = 1;
|
|
|
|
showSlides(slideIndex);
|
|
|
|
function nextSlide() {
|
|
showSlides(slideIndex += 1);
|
|
}
|
|
|
|
function previousSlide() {
|
|
showSlides(slideIndex -= 1);
|
|
}
|
|
|
|
function showSlides(n) {
|
|
let slides = document.getElementsByClassName("slider-line")[0].getElementsByTagName("img");
|
|
|
|
if (n > slides.length) {
|
|
slideIndex = 1
|
|
}
|
|
if (n < 1) {
|
|
slideIndex = slides.length
|
|
}
|
|
|
|
for (let slide of slides) {
|
|
slide.style.display = "none";
|
|
}
|
|
slides[slideIndex - 1].style.display = "block";
|
|
}
|