started work on slideshow code

This commit is contained in:
Nye Evans 2021-01-01 16:28:29 +00:00
parent 9146d50ea5
commit 741f04ebb0
3 changed files with 41 additions and 2 deletions

31
pages/Gallery.js Normal file
View file

@ -0,0 +1,31 @@
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);
}