Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions 01 - JavaScript Drum Kit/index-draft.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
}

function removeTransition(e) {
if(e.propertyName != 'border-left-color') return;
if(e.propertyName !== 'border-left-color') return;
this.classList.remove('playing');
}

Expand All @@ -85,31 +85,30 @@
const keyCode = event.key;

if ( keyCode === '76') {
alert("76");
alert('76');
} else {
alert("false");
alert('false');
}
}

window.addEventListener("keydown", function(e){
window.addEventListener('keydown', function(e){
const audio = document.querySelector(`audio[data-key="${ e.keyCode }"]`);
const key = document.querySelector(`div[data-key="${ e.keyCode }"]`);
// console.log(video);
// console.log(key);
console.log(video);
console.log(key);
if(!audio) return;
audio.currentTime = 0;
audio.play();
key.classList.add("playing");
// key.classList.remove("playing");
key.classList.add('playing');
// key.classList.remove("playing");
}, false);

function removeTransition(e){
// if(e.propertyName !== "border-left-color") return;
// if(e.propertyName !== "border-left-color") return;
console.log(e.propertyName);
// e.target.classList.remove("playing");
// e.target.classList.remove("playing");
}

const keys = document.querySelectorAll('.key');
keys.forEach( keyin => keyin.addEventListener('transitionend', removeTransition));


Expand Down
2 changes: 1 addition & 1 deletion 12 - Key Sequence Detection/index-FINISHED.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\<!DOCTYPE html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
Expand Down