html
html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<!-- LEFT SIDE (MENU SELECTOR) -->
<!-- Building toggleable (LOL) menu -->
<a id="menu" href="#">Menu \/</a>
<div id="submenu">
<a class="link" id="home" href="#">Home</a>
<a class="link" id="explore" href="#">Explore</a>
<a class="link" id="login" href="#">Log in</a>
</div>
</body>
</html>
Enter to Rename, Shift+Enter to Preview
css
css
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
body {
margin: 0;
padding: 0;
background-color: #DDE;
}
#main {
width: 72.5%;
background-color: rgb(242, 242, 242);
margin-right: -1%;
padding-bottom: 0;
left: 12%;
}
a {
font-size: 11px;
display: block;
text-decoration: none;
}
.link {
display: none;
background-color: lightblue;
padding: 5px 0px;
border-bottom: 1px solid red;
}
#menu {
background-color: blue;
color: white;
font-weight: 900;
text-align: center;
Enter to Rename, Shift+Enter to Preview
js
js
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
var on = false;
window.onload = function() {
var menu = document.getElementById("menu");
var submenu = document.getElementById("submenu");
var link = document.getElementsByClassName("link");
menu.onclick = function() {
if(on == false) {
for(var i = 0; i<link.length; i++) {
link[i].style.display = "block";
on = true;
}
}
else {
for(var i = 0; i<link.length; i++) {
link[i].style.display = "none";
on = false;
}
}
}
submenu.onclick = function() {
for(var j = 0; j<link.length; j++) {
link[j].style.display = "none";
on = false;
}
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run