fipamo/public/assets/scripts/theme/Base.js

34 lines
844 B
JavaScript
Raw Normal View History

import Nav from './NavControl.js';
import Audio from './AudioControl.js';
export default class Base {
//--------------------------
// constructor
//--------------------------
constructor() {
this.currentSlide = 0;
this.slides = document.querySelectorAll('.slide');
this.nav = new Nav();
if (document.querySelector('[role="page-meta"]')) {
let audio = new Audio();
}
this.start();
}
start() {
if (this.slides.length > 1) {
this.slideInterval = setInterval(() => {
this.slides[this.currentSlide].className = 'hide';
this.currentSlide = (this.currentSlide + 1) % this.slides.length;
this.slides[this.currentSlide].className = 'show';
}, 3000);
}
}
//--------------------------
// methods
//--------------------------
//--------------------------
// event handlers
//--------------------------
}