-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
74 lines (70 loc) · 2.81 KB
/
index.html
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="icon" href="img/icon.png">
<title>Poke sounds</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>
<body class="container">
<div class="row pokemons">
<div class="col box">
<img id="65" data-key="65" class="pokemon" src="img/OMASTAR.png"/>
<div class="kbd">A</div>
</div>
<div class="col box">
<img id="83" data-key="83" class="pokemon" src="img/aaabaaajss.png"/>
<div class="kbd">S</div>
</div>
<div class="col box">
<img id="68" data-key="68" class="pokemon" src="img/AA-j.png"/>
<div class="kbd">D</div>
</div>
<div class="col box">
<img id="70" data-key="70" class="pokemon" src="img/AAAAAAAAAA.png"/>
<div class="kbd">F</div>
</div>
<div class="col box">
<img id="71" data-key="71" class="pokemon" src="img/AIIIIIIRRR.png"/>
<div class="kbd">G</div>
</div>
<div class="col box">
<img id="72" data-key="72" class="pokemon" src="img/AATTVVV.png"/>
<div class="kbd">H</div>
</div>
</div>
</body>
<audio data-key="65" src="sounds/OMASTAR.mp3"></audio>
<audio data-key="83" src="sounds/aaabaaajss.mp3"></audio>
<audio data-key="68" src="sounds/AA-j.mp3"></audio>
<audio data-key="70" src="sounds/AAAAAAAAAA.mp3"></audio>
<audio data-key="71" src="sounds/AIIIIIIRRR.mp3"></audio>
<audio data-key="72" src="sounds/AATTVVV.mp3"></audio>
<script>
window.addEventListener('keydown', function(e) {
const audio = document.querySelector('audio[data-key="'+e.keyCode+'"]');
const pokemon = document.querySelector('.pokemon[data-key="'+e.keyCode+'"]');
if(!audio) return;
audio.currentTime = 0;
audio.play();
pokemon.classList.add('cry');
audio.onended = function () {
pokemon.classList.remove('cry');
};
});
window.addEventListener("click", function(e) {
const audio = document.querySelector('audio[data-key="'+e.path[0].id+'"]');
const pokemon = document.querySelector('.pokemon[data-key="'+e.path[0].id+'"]');
if(!audio) return;
audio.currentTime = 0;
audio.play();
pokemon.classList.add('cry');
audio.onended = function () {
pokemon.classList.remove('cry');
};
});
</script>
</html>