2021-04-27 03:34:29 +02:00
|
|
|
export default class Base {
|
2022-02-01 00:30:39 +01:00
|
|
|
//--------------------------
|
|
|
|
// constructor
|
|
|
|
//--------------------------
|
|
|
|
constructor() {
|
2022-03-18 01:28:08 +01:00
|
|
|
this.currentSlide = 0;
|
2022-11-01 00:07:19 +01:00
|
|
|
this.slides = document.querySelectorAll('[role="slide"]');
|
|
|
|
//alert("FRESH");
|
2022-02-01 00:30:39 +01:00
|
|
|
this.start();
|
|
|
|
}
|
|
|
|
start() {
|
2022-03-18 01:28:08 +01:00
|
|
|
if (this.slides.length > 1) {
|
|
|
|
this.slideInterval = setInterval(() => {
|
2022-11-01 00:07:19 +01:00
|
|
|
this.slides[this.currentSlide].className = "hide";
|
2022-03-18 01:28:08 +01:00
|
|
|
this.currentSlide = (this.currentSlide + 1) % this.slides.length;
|
2022-11-01 00:07:19 +01:00
|
|
|
this.slides[this.currentSlide].className = "show";
|
2022-03-18 01:28:08 +01:00
|
|
|
}, 3000);
|
|
|
|
}
|
2022-02-01 00:30:39 +01:00
|
|
|
}
|
|
|
|
//--------------------------
|
|
|
|
// methods
|
|
|
|
//--------------------------
|
2021-04-27 03:34:29 +02:00
|
|
|
|
2022-02-01 00:30:39 +01:00
|
|
|
//--------------------------
|
|
|
|
// event handlers
|
|
|
|
//--------------------------
|
2021-04-27 03:34:29 +02:00
|
|
|
}
|