Day01 funkction
This commit is contained in:
BIN
adventskalender/2025/assets/sounds/FallingSnow.mp3
Normal file
BIN
adventskalender/2025/assets/sounds/FallingSnow.mp3
Normal file
Binary file not shown.
@@ -59,9 +59,37 @@ function openPopup(day) {
|
||||
.then(html => {
|
||||
popupContent.innerHTML = `<h2>${data.title}</h2>${html}`;
|
||||
popupOverlay.classList.add("active");
|
||||
|
||||
// === Tag 1: Soundeffekt + Daumenkino starten ===
|
||||
if (day === 1) {
|
||||
setTimeout(() => {
|
||||
try {
|
||||
// --- Soundeffekt FallingSnow ---
|
||||
const sound = new Audio("/2025/assets/sounds/FallingSnow.mp3");
|
||||
sound.volume = 0.5;
|
||||
sound.play().catch(() => {});
|
||||
|
||||
// --- Daumenkino-Video (Fallback-Start) ---
|
||||
const thumbkino = popupContent.querySelector(".thumbkino-video");
|
||||
if (thumbkino) {
|
||||
thumbkino.muted = true;
|
||||
thumbkino.loop = true;
|
||||
thumbkino.play().catch(() => {});
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn("FallingSnow oder Daumenkino konnten nicht abgespielt werden:", err);
|
||||
}
|
||||
}, 250); // leichte Verzögerung nach DOM-Einbindung
|
||||
} else {
|
||||
// === alle anderen Tage: nur Video-Autoplay sicherstellen ===
|
||||
setTimeout(() => {
|
||||
const videos = popupContent.querySelectorAll("video[autoplay]");
|
||||
videos.forEach(v => v.play().catch(() => {}));
|
||||
}, 250);
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
// Fallback auf bekannte JS-Daten
|
||||
// === Fallback auf Platzhalterinhalt ===
|
||||
popupContent.innerHTML = `<h2>${data.title}</h2>${data.content}`;
|
||||
popupOverlay.classList.add("active");
|
||||
console.warn(`Türchen ${day}: HTML konnte nicht geladen werden. Fallback verwendet.`, err);
|
||||
|
||||
Reference in New Issue
Block a user