Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions js/components/dcf-slideshow.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,10 @@ width="24" height="24" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
throw new Error(`Bad auto slide advance rate: ${this.slideshowContainer.dataset.rate}`);
}
}
this.slideDeck.addEventListener('mouseOver', () => {
this.slideshowContainer.addEventListener('mouseover', () => {
this.mouseOver = true;
});
this.slideDeck.addEventListener('mouseOut', () => {
this.slideshowContainer.addEventListener('mouseout', () => {
this.mouseOver = false;
});
}
Expand All @@ -243,6 +243,18 @@ width="24" height="24" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
this.#initSlides();
this.#initControls();

// This needs to go after init controls so we can change the state of the toggle button
if (this.allowPlay) {
if (!(window.matchMedia('(prefers-reduced-motion: reduce)').matches)) {
const startPlaying = this.slideshowContainer.hasAttribute('data-start-playing') && (
this.slideshowContainer.dataset.startPlaying.toLowerCase() === 'true'
);
if (startPlaying) {
this.play();
}
}
}

this.slideshowContainer.classList.add('dcf-slideshow-initialized');
this.slideshowContainer.removeAttribute('hidden');

Expand Down