xxxxxxxxxx
1
<div class="hamburger">
2
<svg data-mdb-toggle="collapse"
3
data-mdb-target="#navbarToggleExternalContent" id="icon" viewBox="0 0 800 600">
4
<path d="M300,220 C300,220 520,220 540,220 C740,220 640,540 520,420 C440,340 300,200 300,200" id="top"></path>
5
<path d="M300,320 L540,320" id="middle"></path>
6
<path d="M300,210 C300,210 520,210 540,210 C740,210 640,530 520,410 C440,330 300,190 300,190" id="bottom" transform="translate(480, 320) scale(1, -1) translate(-480, -318) "></path>
7
</svg>
8
</div>
9
<nav class="navbar navbar-expand-lg navbar-light bg-light">
10
<!-- Container wrapper -->
11
<div class="container-fluid">
12
<!-- Toggle button -->
13
14
<!-- Collapsible wrapper -->
15
<div
16
class="collapse navbar-collapse justify-content-center "
17
id="navbarCenteredExample"
18
>
19
<!-- Left links -->
20
<ul class="navbar-nav mb-2 mb-lg-0">
21
<li class="nav-item">
22
<a class="nav-link active" aria-current="page" href="#">Home</a>
23
</li>
24
<li class="nav-item">
25
<a class="nav-link" href="#">Link</a>
26
</li>
27
<!-- Navbar dropdown -->
28
<li class="nav-item dropdown">
29
<a
30
class="nav-link dropdown-toggle"
31
href="#"
32
id="navbarDropdown"
33
role="button"
34
data-mdb-toggle="dropdown"
35
aria-expanded="false"
36
>
37
Dropdown
38
</a>
39
<!-- Dropdown menu -->
40
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
41
<li>
42
<a class="dropdown-item" href="#">Action</a>
43
</li>
44
<li>
45
<a class="dropdown-item" href="#">Another action</a>
46
</li>
47
<li><hr class="dropdown-divider" /></li>
48
<li>
49
<a class="dropdown-item" href="#">Something else here</a>
50
</li>
51
</ul>
52
</li>
53
<li class="nav-item">
54
<a class="nav-link disabled"
55
>Disabled</a
56
>
57
</li>
58
</ul>
59
<!-- Left links -->
60
</div>
61
<!-- Collapsible wrapper -->
62
</div>
63
<!-- Container wrapper -->
64
</nav>
65
66
<div style="height: 1000px">
67
68
</div>
xxxxxxxxxx
1
.hamburger {
2
position: fixed;
3
z-index: 2;
4
top: -10px;
5
}
6
7
#icon {
8
width: 75px;
9
height: 75px;
10
cursor: pointer;
11
transform: translate3d(0, 0, 0);
12
}
13
path {
14
fill: none;
15
transition: stroke-dashoffset 0.5s cubic-bezier(0.25, -0.25, 0.75, 1.25), stroke-dasharray 0.5s cubic-bezier(0.25, -0.25, 0.75, 1.25);
16
stroke-width: 40px;
17
stroke-linecap: round;
18
stroke: #a06ba5;
19
stroke-dashoffset: 0px;
20
}
21
path#top,
22
path#bottom {
23
stroke-dasharray: 240px 950px;
24
}
25
path#middle {
26
stroke-dasharray: 240px 240px;
27
}
28
.cross path#top,
29
.cross path#bottom {
30
stroke-dashoffset: -650px;
31
stroke-dashoffset: -650px;
32
}
33
.cross path#middle {
34
stroke-dashoffset: -115px;
35
stroke-dasharray: 1px 220px;
36
}
xxxxxxxxxx
1
var el = document.querySelector('.hamburger');
2
3
el.onclick = function() {
4
el.classList.toggle('cross');
5
}
Console errors: 0