You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
730 B
JavaScript
28 lines
730 B
JavaScript
3 years ago
|
export default class Base {
|
||
3 years ago
|
//--------------------------
|
||
|
// constructor
|
||
|
//--------------------------
|
||
|
constructor() {
|
||
3 years ago
|
this.currentSlide = 0;
|
||
2 years ago
|
this.slides = document.querySelectorAll('[role="slide"]');
|
||
|
//alert("FRESH");
|
||
3 years ago
|
this.start();
|
||
|
}
|
||
|
start() {
|
||
3 years ago
|
if (this.slides.length > 1) {
|
||
|
this.slideInterval = setInterval(() => {
|
||
2 years ago
|
this.slides[this.currentSlide].className = "hide";
|
||
3 years ago
|
this.currentSlide = (this.currentSlide + 1) % this.slides.length;
|
||
2 years ago
|
this.slides[this.currentSlide].className = "show";
|
||
3 years ago
|
}, 3000);
|
||
|
}
|
||
3 years ago
|
}
|
||
|
//--------------------------
|
||
|
// methods
|
||
|
//--------------------------
|
||
3 years ago
|
|
||
3 years ago
|
//--------------------------
|
||
|
// event handlers
|
||
|
//--------------------------
|
||
3 years ago
|
}
|