2024-03-14 23:58:11 +01:00
|
|
|
export default class Base {
|
|
|
|
//--------------------------
|
|
|
|
// constructor
|
|
|
|
//--------------------------
|
|
|
|
constructor() {
|
|
|
|
this.currentSlide = 0;
|
2024-04-23 21:41:41 +02:00
|
|
|
this.slides = document.querySelectorAll('.slide');
|
2024-03-14 23:58:11 +01:00
|
|
|
//alert('FRESH');
|
2024-04-23 21:41:41 +02:00
|
|
|
document.getElementById('menu-open').addEventListener('click', e => {
|
|
|
|
document.getElementById('menu').style.opacity = '100%';
|
|
|
|
document.getElementById('menu').style.visibility = 'visible';
|
|
|
|
});
|
|
|
|
document.getElementById('menu-close').addEventListener('click', e => {
|
|
|
|
document.getElementById('menu').style.opacity = '0';
|
|
|
|
document.getElementById('menu').style.visibility = 'hidden';
|
|
|
|
});
|
2024-03-14 23:58:11 +01:00
|
|
|
this.start();
|
|
|
|
}
|
|
|
|
start() {
|
|
|
|
if (this.slides.length > 1) {
|
|
|
|
this.slideInterval = setInterval(() => {
|
2024-04-23 21:41:41 +02:00
|
|
|
this.slides[this.currentSlide].className = 'hide slide';
|
2024-03-14 23:58:11 +01:00
|
|
|
this.currentSlide = (this.currentSlide + 1) % this.slides.length;
|
2024-04-23 21:41:41 +02:00
|
|
|
this.slides[this.currentSlide].className = 'show slide';
|
2024-03-14 23:58:11 +01:00
|
|
|
}, 3000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//--------------------------
|
|
|
|
// methods
|
|
|
|
//--------------------------
|
|
|
|
|
|
|
|
//--------------------------
|
|
|
|
// event handlers
|
|
|
|
//--------------------------
|
|
|
|
}
|