kommer snart...

document.addEventListener('DOMContentLoaded', function () { const letterEls = document.querySelectorAll('.letter-sound'); letterEls.forEach(function (el) { const audioIndex = el.getAttribute('data-audio'); if (!audioIndex) return; // ÄNDRA sökvägen nedan till där du har lagt dina ljudfiler const audio = new Audio('/wp-content/uploads/sounds/' + audioIndex + '.mp3'); let isPlaying = false; function playOnce() { if (isPlaying) return; isPlaying = true; audio.currentTime = 0; audio.play().catch(err => console.warn('Ljudfel:', err)); audio.onended = () => (isPlaying = false); } // Hover (desktop) el.addEventListener('mouseenter', playOnce); // Klick (mobil + desktop) el.addEventListener('click', function (e) { e.preventDefault(); playOnce(); }); }); });
document.addEventListener('DOMContentLoaded', function () { const letterEls = document.querySelectorAll('.letter-sound'); letterEls.forEach(function (el) { const audioIndex = el.getAttribute('data-audio'); if (!audioIndex) return; // ÄNDRA sökvägen nedan till där du har lagt dina ljudfiler const audio = new Audio('/wp-content/uploads/sounds/' + audioIndex + '.mp3'); let isPlaying = false; function playOnce() { if (isPlaying) return; isPlaying = true; audio.currentTime = 0; audio.play().catch(err => console.warn('Ljudfel:', err)); audio.onended = () => (isPlaying = false); } // Hover (desktop) el.addEventListener('mouseenter', playOnce); // Klick (mobil + desktop) el.addEventListener('click', function (e) { e.preventDefault(); playOnce(); }); }); });