-
Notifications
You must be signed in to change notification settings - Fork 108
Expand file tree
/
Copy pathindex.html
More file actions
57 lines (46 loc) · 920 Bytes
/
index.html
File metadata and controls
57 lines (46 loc) · 920 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
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
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<style>
.menu ul {
margin: 0;
list-style: none;
padding-left: 20px;
display: none;
}
.menu .title {
font-size: 18px;
cursor: pointer;
}
.menu .title::before {
content: '▶ ';
font-size: 80%;
color: green;
}
.menu.open .title::before {
content: '▼ ';
}
.menu.open ul {
display: block;
}
</style>
</head>
<body>
<div id="sweeties" class="menu">
<span class="title">Gâteaux (cliquez moi)!</span>
<ul>
<li>Tarte aux pommes</li>
<li>Cookies</li>
<li>Brownies</li>
</ul>
</div>
<script>
let menuElem = document.getElementById('sweeties');
let titleElem = menuElem.querySelector('.title');
titleElem.onclick = function() {
menuElem.classList.toggle('open');
};
</script>
</body>
</html>