started work on slideshow code
This commit is contained in:
parent
9146d50ea5
commit
741f04ebb0
3 changed files with 41 additions and 2 deletions
31
pages/Gallery.js
Normal file
31
pages/Gallery.js
Normal 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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue