Portfolio/pages/Gallery.js
2021-01-01 16:28:29 +00:00

31 lines
No EOL
518 B
JavaScript

class slide{
constructor(title, caption, image){
this.title = title;
this.caption = caption;
this.image = image;
}
}
var currentSlide = 0;
var slides = []
function nextSlide(){
currentSlide++;
updateSlide();
}
function lastSlide(){
currentSlide--;
updateSlide();
}
function updateSlide(){
if (currentSlide > slides.length){
currentSlide = 0;
} else if (currentSlide < 0){
currentSlide = slides.length;
}
console.log(currentSlide);
}