Skip to content

Commit

Permalink
melhorias no código
Browse files Browse the repository at this point in the history
  • Loading branch information
herminiotorres committed Jul 6, 2018
1 parent cdeb656 commit a065d44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions 01-JavaScriptDrumKit/finish.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,18 @@
const audio = document.querySelector(`audio[data-key="${event.keyCode}"]`);
const key = document.querySelector(`.key[data-key="${event.keyCode}"]`);
if (!audio) return;
key.classList.add('playing');
audio.currentTime = 0;
audio.play();
key.classList.add('playing');
}

function removeTransition(event) {
if (event.propertyName !== 'transform') return;
if (event.type !== 'transitionend') return;
this.classList.remove('playing');
}

const keys = document.querySelectorAll('.key');
keys.forEach(key => key.addEventListener('transitionend', removeTransition));
keys.forEach(key => key.addEventListener('transitionend', removeTransition, false));
window.addEventListener('keydown', playSound);
</script>

Expand Down
3 changes: 2 additions & 1 deletion 01-JavaScriptDrumKit/style.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
html {
font-size: 10px;
background: #696969;
background: url(https://images.unsplash.com/photo-1511220043390-e929fe0edf55?ixlib=rb-0.3.5&s=d327150ad68af513021310ffef6a1a60) bottom center;
background-size: cover;
}
body,html {
margin: 0;
Expand Down

0 comments on commit a065d44

Please sign in to comment.