forked from FrDH/mburger-webcomponent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
177 lines (162 loc) · 5.7 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="author" content="www.frebsite.nl" />
<meta name="viewport" content="width=device-width user-scalable=no" />
<meta name="robots" content="noindex, nofollow" />
<title>mburger, CSS animated hamburgers!</title>
<link
type="text/css"
rel="stylesheet"
href="http://fonts.googleapis.com/css?family=Pacifico"
/>
<link type="text/css" rel="stylesheet" href="bin/demo.css" />
<link type="text/css" rel="stylesheet" href="dist/mburger.css" />
<script type="module" src="dist/mburger.js"></script>
</head>
<body>
<div id="page">
<h1>mburger</h1>
<p>
A small collection of CSS animated hamburgers. All set up to
work out of the box with the mmenu.js plugin. Click a hamburger
to see the animation. More info
<a href="https://www.mmenujs.com/mburger" target="_blank"
>here</a
>.
</p>
<div class="xmpls">
<div class="xmpl">
<button class="mburger mburger--collapse">
<b></b>
<b></b>
<b></b>
</button>
<span>collapse</span>
</div>
<div class="xmpl">
<button class="mburger mburger--spin">
<b></b>
<b></b>
<b></b>
</button>
<span>spin</span>
</div>
<div class="xmpl">
<button class="mburger mburger--squeeze">
<b></b>
<b></b>
<b></b>
</button>
<span>squeeze</span>
</div>
<div class="xmpl">
<button class="mburger mburger--tornado">
<b></b>
<b></b>
<b></b>
</button>
<span>tornado</span>
</div>
</div>
<pre>
<html>
<head>
<style type="text/css" rel="stylesheet" href="dist/mburger.css">
</heady>
<body>
<button class="mburger mburger--spin" href="#my-menu">
<b</b>
<b</b>
<b</b>
</button>
</body>
</html>
</pre
>
<h3>Customize the hamburger</h3>
<p>
By default, the hamburger adopts to its environment pretty good,
the bars scale to fit and inherit their <code>color</code> for
the parent element.
</p>
<p>
The hamburger is pretty easy to customize too, just override
some of the CSS values and variables.
</p>
<div class="xmpls">
<div class="xmpl">
<button class="reset custom-button-1">
<span class="mburger mburger--spin">
<b></b>
<b></b>
<b></b>
<span>Menu</span>
</span>
</button>
</div>
<div class="xmpl">
<button class="custom-button-2 mburger mburger--spin">
<b></b>
<b></b>
<b></b>
</button>
</div>
</div>
<p>
For more examples and the full documentation, please visit:
<a href="https://www.mmenujs.com/mburger" target="_blank"
>mmenujs.com/mburger</a
>.
</p>
<br />
<h3>Native webcomponent</h3>
<p>
Note: If you want to run these examples locally, you need to run
them through a local web server. Otherwise the
<code><script type="module"></code> will be
blocked by CORS policy.
</p>
<div class="xmpls">
<div class="xmpl">
<m-burger fx="collapse"></m-burger>
<span>collapse</span>
</div>
<div class="xmpl">
<m-burger fx="spin"></m-burger>
<span>spin</span>
</div>
</div>
<pre>
<html>
<head>
<script type="module" src="dist/mburger.js"></script>
</heady>
<body>
<m-burger fx="spin" menu="my-menu"></m-burger>
</body>
</html>
</pre
>
</div>
<script>
document.addEventListener("click", (evnt) => {
var target = evnt.target;
let xmpl = target.closest(".xmpl");
if (xmpl) {
let webcomponent = xmpl.querySelector("m-burger");
if (webcomponent) {
if (webcomponent.getAttribute("state")) {
webcomponent.removeAttribute("state");
} else {
webcomponent.setAttribute("state", "cross");
}
} else {
xmpl.classList.toggle("mm-wrapper--opened");
}
}
});
</script>
</body>
</html>