Skip to content

Commit ad8ce08

Browse files
author
AhmedShab
committed
finished the first chellange
1 parent ad74722 commit ad8ce08

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

01 - JavaScript Drum Kit/main.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const keys = document.querySelectorAll('.keys');
22

3-
keys.forEach(key => {
4-
});
3+
keys.forEach(key => { key.addEventListener('transitionend', removeTransition)});
54

65
this.addEventListener('keydown', playSound);
76

@@ -13,5 +12,12 @@ function playSound(e) {
1312
if (keys) {
1413
const play = new Audio(audio.src);
1514
play.play();
15+
keys.classList.add('playing')
16+
}
17+
}
18+
19+
function removeTransition (e) {
20+
if(e.propertyName === 'transform'){
21+
e.target.className = 'key';
1622
}
1723
}

0 commit comments

Comments
 (0)