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 69
69
}
70
70
71
71
function removeTransition ( e ) {
72
- if ( e . propertyName != 'border-left-color' ) return ;
72
+ if ( e . propertyName !== 'border-left-color' ) return ;
73
73
this . classList . remove ( 'playing' ) ;
74
74
}
75
75
85
85
const keyCode = event . key ;
86
86
87
87
if ( keyCode === '76' ) {
88
- alert ( "76" ) ;
88
+ alert ( '76' ) ;
89
89
} else {
90
- alert ( " false" ) ;
90
+ alert ( ' false' ) ;
91
91
}
92
92
}
93
93
94
- window . addEventListener ( " keydown" , function ( e ) {
94
+ window . addEventListener ( ' keydown' , function ( e ) {
95
95
const audio = document . querySelector ( `audio[data-key="${ e . keyCode } "]` ) ;
96
96
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 ) ;
99
99
if ( ! audio ) return ;
100
100
audio . currentTime = 0 ;
101
101
audio . play ( ) ;
102
- key . classList . add ( " playing" ) ;
103
- // key.classList.remove("playing");
102
+ key . classList . add ( ' playing' ) ;
103
+ // key.classList.remove("playing");
104
104
} , false ) ;
105
105
106
106
function removeTransition ( e ) {
107
- // if(e.propertyName !== "border-left-color") return;
107
+ // if(e.propertyName !== "border-left-color") return;
108
108
console . log ( e . propertyName ) ;
109
- // e.target.classList.remove("playing");
109
+ // e.target.classList.remove("playing");
110
110
}
111
111
112
- const keys = document . querySelectorAll ( '.key' ) ;
113
112
keys . forEach ( keyin => keyin . addEventListener ( 'transitionend' , removeTransition ) ) ;
114
113
115
114
Original file line number Diff line number Diff line change 1
- \ <!DOCTYPE html>
1
+ <!DOCTYPE html>
2
2
< html lang ="en ">
3
3
< head >
4
4
< meta charset ="UTF-8 ">
You can’t perform that action at this time.
0 commit comments