-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
36 lines (31 loc) · 888 Bytes
/
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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>Document</title>
</head>
<body>
<div id="foo">
<p class="show"> TACO </p>
<p class="hide"> FISH </p>
<button id="elem">FOO</button>
</div>
</body>
<script>
document.onreadystatechange = function () {
console.log(document.readyState);
}
var elem = document.querySelector('#elem');
document.addEventListener('click', function (event) {
console.log('wut');
if (event.target.matches('.show')) {
elem.removeAttribute('hidden');
elem.classList.add('fadeInDown');
}
if (event.target.matches('.hide')) {
elem.setAttribute('hidden', 'true');
elem.classList.remove('fadeInDown');
}
}, false);
</script>
</html>