-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
20 lines (18 loc) · 778 Bytes
/
Copy pathscript.js
File metadata and controls
20 lines (18 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
document.addEventListener('DOMContentLoaded', () => {
const startAnimation = () => {
const pedroAudio = document.getElementById('pedroAudio')
const pedroImage = document.getElementById('pedroImage')
const imgOverlay = document.getElementById('imgOverlay')
if (pedroAudio.paused) {
pedroAudio.play()
imgOverlay.setAttribute('title', 'Give the Raccoon a break!')
pedroImage.classList.add('animate')
} else {
pedroAudio.pause()
imgOverlay.setAttribute('title', 'Let the Raccoon dance!')
pedroImage.classList.remove('animate')
}
}
const imgOverlay = document.getElementById('imgOverlay')
imgOverlay.addEventListener('click', startAnimation)
})