+ 1
Why doesn't the slider work?
2 odpowiedzi
+ 5
This correct code for next() function:
var images = [
"https://i.postimg.cc/1X3c299L/images.jpg", "https://i.postimg.cc/sDB0gcrb/images-2.jpg"];
var num = 0;
function next() {
var slider = document.getElementById("slider");
num++;
if( num > images.length-1) {
num = 0;
}
slider.src = images[num];
}
function prev() {
var slider =
document.getElementById("slider");
num--;
if( num < 0) {
num = images.length-1;
}
slider.src = images[num];
}
+ 3
Thank you!