We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 61b13da commit fd62ffaCopy full SHA for fd62ffa
01 - JavaScript Drum Kit/index-START.html
@@ -58,7 +58,13 @@
58
<audio data-key="76" src="sounds/tink.wav"></audio>
59
60
<script>
61
-
+ document.body.onkeydown = function(e){
62
+ var key = document.querySelector(`.key[data-key="${e.which}"]`)
63
+ var audio = document.querySelector(`audio[data-key="${e.which}"]`)
64
+ audio.play()
65
+ key.classList.add('playing')
66
+ setTimeout(() => key.classList.remove('playing'), 60)
67
+ }
68
</script>
69
70
0 commit comments