File tree Expand file tree Collapse file tree 2 files changed +11
-12
lines changed
12 - Key Sequence Detection Expand file tree Collapse file tree 2 files changed +11
-12
lines changed Original file line number Diff line number Diff line change 6969 }
7070
7171 function removeTransition ( e ) {
72- if ( e . propertyName != 'border-left-color' ) return ;
72+ if ( e . propertyName !== 'border-left-color' ) return ;
7373 this . classList . remove ( 'playing' ) ;
7474 }
7575
8585 const keyCode = event . key ;
8686
8787 if ( keyCode === '76' ) {
88- alert ( "76" ) ;
88+ alert ( '76' ) ;
8989 } else {
90- alert ( " false" ) ;
90+ alert ( ' false' ) ;
9191 }
9292 }
9393
94- window . addEventListener ( " keydown" , function ( e ) {
94+ window . addEventListener ( ' keydown' , function ( e ) {
9595 const audio = document . querySelector ( `audio[data-key="${ e . keyCode } "]` ) ;
9696 const key = document . querySelector ( `div[data-key="${ e . keyCode } "]` ) ;
97- // console.log(video);
98- // console.log(key);
97+ console . log ( video ) ;
98+ console . log ( key ) ;
9999 if ( ! audio ) return ;
100100 audio . currentTime = 0 ;
101101 audio . play ( ) ;
102- key . classList . add ( " playing" ) ;
103- // key.classList.remove("playing");
102+ key . classList . add ( ' playing' ) ;
103+ // key.classList.remove("playing");
104104 } , false ) ;
105105
106106 function removeTransition ( e ) {
107- // if(e.propertyName !== "border-left-color") return;
107+ // if(e.propertyName !== "border-left-color") return;
108108 console . log ( e . propertyName ) ;
109- // e.target.classList.remove("playing");
109+ // e.target.classList.remove("playing");
110110 }
111111
112- const keys = document . querySelectorAll ( '.key' ) ;
113112 keys . forEach ( keyin => keyin . addEventListener ( 'transitionend' , removeTransition ) ) ;
114113
115114
Original file line number Diff line number Diff line change 1- \ <!DOCTYPE html>
1+ <!DOCTYPE html>
22< html lang ="en ">
33< head >
44 < meta charset ="UTF-8 ">
You can’t perform that action at this time.
0 commit comments