forked from chalkers/3-line-menu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
78 lines (74 loc) · 1.21 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
75
76
77
78
<!DOCTYPE>
<html>
<head>
<title>Responsive 3-Line Menu</title>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
ul {
width:100%;
}
li {
width:33%;
float:left;
border-right: 1px solid #eee;
}
li:last-child {
border-right:none;
}
li a {
display: block;
width:80%;
background:#ddd;
padding:4% 10%;
font-size:1.35em;
text-decoration: none;
}
@media screen and (max-width: 768px) {
#menu {
width:1.4em;
display: block;
background:#ddd;
font-size:1.35em;
text-align: center;
}
#nav.js {
display: none;
}
ul {
width:100%;
}
li {
width:100%;
border-right:none;
}
}
@media screen and (min-width: 768px) {
#menu {
display: none;
}
}
</style>
</head>
<body>
<ul id="nav">
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript">
$("#nav").addClass("js").before('<div id="menu">☰</div>');
$("#menu").click(function(){
$("#nav").toggle();
});
$(window).resize(function(){
if(window.innerWidth > 768) {
$("#nav").removeAttr("style");
}
});
</script>
</body>
</html>