-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhoverclick.html
More file actions
93 lines (87 loc) · 2.23 KB
/
hoverclick.html
File metadata and controls
93 lines (87 loc) · 2.23 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hover & Click</title>
<style>
#colors {
display: none;
}
#colors-to-select:hover #colors {
display: block;
}
#color {
display: none;
}
#color-to-select:hover #color {
display: block;
}
li {
list-style-type: none;
}
body {
font-family:'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
font-size: 30px;
background-color: black;
margin: 10%;
}
a {
color: rgb(167, 3, 3);
text-decoration: none;
}
</style>
<body>
<div id="colors-to-select">
<a href="#">Colors</a>
<ul id="colors">
<li>
<ul id="color-to-select">
<a href="#"> Blue </a>
<ul id="color">
<li> <a href="#">Cobalt</a> </li>
<li> <a href="#">Turquoise</a> </li>
</ul>
</ul>
</li>
<li>
<ul id="color-to-select">
<a href="#"> Green </a>
<ul id="color">
<li> <a href="#">Navy</a> </li>
<li> <a href="#">Forest</a> </li>
</ul>
</ul>
</li>
<li>
<ul id="color-to-select">
<a href="#"> Red </a>
<ul id="color">
<li> <a href="#">Maroon</a> </li>
<li> <a href="#">Ruby</a> </li>
</ul>
</ul>
</li>
<li>
<ul id="color-to-select">
<a href="#"> Yellow </a>
<ul id="color">
<li> <a href="#">Sunshine</a> </li>
<li> <a href="#">Pale</a> </li>
</ul>
</ul>
</li>
</ul>
</div>
<script>
document.querySelector("#colors-to-select").addEventListener("click", () => {
var elt = document.querySelector("#colors").style.display;
if (elt === "none" || elt === "") {
document.querySelector("#colors").style.display="block";
} else {
document.querySelector("#colors").style.display="none";
}
})
</script>
</body>
</html>