window.addEventListener('load', function() { var preload = document.querySelector('.preload'), playBtn = document.querySelector('.preload-button'), player = document.querySelector('.player'), aliceIn = document.querySelector('.alice1'), aliceOut = document.querySelector('.alice3'), moan = document.querySelector('.moan'); moan.addEventListener('playing', function() { aliceIn.classList.add('heartbeat-in'); aliceOut.classList.add('heartbeat-out'); }); preload.addEventListener('click', function() { preload.classList.add('hidden'); player.classList.remove('hidden'); moan.play(); }); playBtn.classList.remove('hidden'); });