We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3ff5e06 commit 38f92deCopy full SHA for 38f92de
1 file changed
01 - JavaScript Drum Kit/index-START.html
@@ -58,7 +58,7 @@
58
<audio data-key="76" src="sounds/tink.wav"></audio>
59
60
<script>
61
- window.addEventListener('keydown', (event) => {
+ const playSound = (event) => {
62
console.log('keydown event: ', event);
63
console.log('keycode: ', event.keyCode);
64
const audio = document
@@ -71,7 +71,7 @@
71
audio.currentTime = 0; // rewind to the start
72
audio.play();
73
key.classList.add('playing');
74
- });
+ };
75
const removeTransition = function (event) {
76
console.log('removeTransition event: ', event);
77
if (event.propertyName !== 'transform') return; // skip it if its not a transform
@@ -84,6 +84,7 @@
84
console.log('keys: ', keys);
85
keys.forEach(key => key
86
.addEventListener('transitionend', removeTransition));
87
+ window.addEventListener('keydown', playSound);
88
</script>
89
90
0 commit comments