-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
32 lines (27 loc) · 893 Bytes
/
script.js
File metadata and controls
32 lines (27 loc) · 893 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
document.addEventListener('keydown', function (event) {
var audioId = document.getElementById('' + event.keyCode);
if (audioId == null) {
return;
}
var keypressed = document.getElementById('k' + event.keyCode).classList;
keypressed.add('play');
audioId.currentTime = 0;
audioId.play();
setTimeout(function () {
keypressed.remove('play');
}, 150);
})
// mazel na9sa
// document.addEventListener('click', function (event) {
// var audioId = document.getElementById('' + event.keyCode);
// if (audioId == null) {
// return;
// }
// var keypressed = document.getElementById('k' + event.keyCode).classList;
// keypressed.add('play');
// audioId.currentTime = 0;
// audioId.play();
// setTimeout(function () {
// keypressed.remove('play');
// }, 150);
// })