From bdddcba722822e363c395f5b95b9b6f92eb49eee Mon Sep 17 00:00:00 2001 From: Yash Vashishth Date: Sat, 18 Nov 2017 22:29:24 -0600 Subject: [PATCH] 1 of 30 --- 01 - JavaScript Drum Kit/index-START.html | 65 +++++++++++++++++++++-- 1 file changed, 62 insertions(+), 3 deletions(-) diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 4070d32767..db9c727663 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -1,10 +1,12 @@ + JS Drum Kit + @@ -57,10 +59,67 @@ - + highlightBox(code); + }); + + + //window.addEventListener('keyup', function keyUp(ev) { + //let code = ev.keyCode; + + //removeHighlightBox(code); + // let soundSelector = `audio[data-key='${code}']`; + // let audioElement = document.querySelector(soundSelector); + // if (audioElement != undefined) audioElement.play(); + //}); + + + } + + function setupTransition(selector) { + let keyBoxes = document.querySelectorAll('.key'); + keyBoxes.forEach(keyBox => keyBox.addEventListener('transitionend', removeHighlightBox)); + } + + setupSound(); + setupTransition(); + - + + \ No newline at end of file