From 66e667489162fc04f49da090e7f6246d59fad779 Mon Sep 17 00:00:00 2001 From: sunha1yang <934659456@qq.com> Date: Fri, 21 Apr 2017 00:24:21 +0800 Subject: [PATCH] =?UTF-8?q?upd:=20=E4=BF=AE=E6=94=B9=E7=BC=96=E7=A0=81?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=20+=20fix=20const=E9=87=8D=E5=A4=8D=E5=A3=B0?= =?UTF-8?q?=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 01 - JavaScript Drum Kit/index-draft.html | 21 +++++++++---------- .../index-FINISHED.html | 2 +- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/01 - JavaScript Drum Kit/index-draft.html b/01 - JavaScript Drum Kit/index-draft.html index 1e4bfab..903fcc3 100644 --- a/01 - JavaScript Drum Kit/index-draft.html +++ b/01 - JavaScript Drum Kit/index-draft.html @@ -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'); } @@ -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)); diff --git a/12 - Key Sequence Detection/index-FINISHED.html b/12 - Key Sequence Detection/index-FINISHED.html index f42ccd0..393abf0 100644 --- a/12 - Key Sequence Detection/index-FINISHED.html +++ b/12 - Key Sequence Detection/index-FINISHED.html @@ -1,4 +1,4 @@ -\ +