xxxxxxxxxx
1
<!--Main Navigation-->
2
<header>
3
<!-- Sidenav-->
4
<nav
5
id="sidenav-4"
6
class="sidenav"
7
data-mdb-mode="side"
8
data-mdb-slim="true"
9
data-mdb-slim-collapsed="true"
10
data-mdb-content="#slim-content"
11
>
12
<ul class="sidenav-menu">
13
<li class="sidenav-item">
14
<a class="sidenav-link">
15
<i class="far fa-smile me-3"></i
16
><span data-mdb-slim="false">Link 1</span></a
17
>
18
</li>
19
<li class="sidenav-item">
20
<a class="sidenav-link"
21
><i class="fas fa-grin me-3"></i
22
><span data-mdb-slim="false">Category 1</span></a
23
>
24
<ul class="sidenav-collapse">
25
<li class="sidenav-item">
26
<a class="sidenav-link">Link 2</a>
27
</li>
28
<li class="sidenav-item">
29
<a class="sidenav-link">Link 3</a>
30
</li>
31
</ul>
32
</li>
33
<li class="sidenav-item">
34
<a class="sidenav-link"
35
><i class="fas fa-grin-wink me-3"></i
36
><span data-mdb-slim="false">Category 2</span></a
37
>
38
<ul class="sidenav-collapse">
39
<li class="sidenav-item">
40
<a class="sidenav-link">Link 4</a>
41
</li>
42
<li class="sidenav-item">
43
<a class="sidenav-link">Link 5</a>
44
</li>
45
</ul>
46
</li>
47
</ul>
48
</nav>
49
<!-- Sidenav-->
50
51
<!-- Navbar -->
52
<nav
53
id="main-navbar"
54
class="navbar navbar-expand-lg navbar-light bg-white fixed-top"
55
>
56
<!-- Container wrapper -->
57
<div class="container-fluid">
58
<!-- Toggler -->
59
<button
60
data-mdb-toggle="sidenav"
61
data-mdb-target="#sidenav-4"
62
class="btn shadow-0 p-0 me-3 d-block d-xxl-none"
63
aria-controls="#sidenav-4"
64
aria-haspopup="true"
65
>
66
<i class="fas fa-bars fa-lg"></i>
67
</button>
68
69
<!-- Search form -->
70
<form class="d-none d-md-flex input-group w-auto my-auto">
71
<input
72
autocomplete="off"
73
type="search"
74
class="form-control rounded"
75
placeholder='Search (ctrl + "/" to focus)'
76
style="min-width: 225px"
77
/>
78
<span class="input-group-text border-0"
79
><i class="fas fa-search"></i
80
></span>
81
</form>
82
83
<!-- Right links -->
84
<ul class="navbar-nav ms-auto d-flex flex-row">
85
<!-- Notification dropdown -->
86
<li class="nav-item dropdown">
87
<a
88
class="nav-link me-3 me-lg-0 dropdown-toggle hidden-arrow"
89
href="#"
90
id="navbarDropdownMenuLink"
91
role="button"
92
data-mdb-toggle="dropdown"
93
aria-expanded="false"
94
>
95
<i class="fas fa-bell"></i>
96
<span class="badge rounded-pill badge-notification bg-danger"
97
>1</span
98
>
99
</a>
100
<ul
101
class="dropdown-menu dropdown-menu-end"
102
aria-labelledby="navbarDropdownMenuLink"
103
>
104
<li><a class="dropdown-item" href="#">Some news</a></li>
105
<li><a class="dropdown-item" href="#">Another news</a></li>
106
<li>
107
<a class="dropdown-item" href="#">Something else here</a>
108
</li>
109
</ul>
110
</li>
111
112
<!-- Icon -->
113
<li class="nav-item">
114
<a class="nav-link me-3 me-lg-0" href="#">
115
<i class="fas fa-fill-drip"></i>
116
</a>
117
</li>
118
<!-- Icon -->
119
<li class="nav-item me-3 me-lg-0">
120
<a class="nav-link" href="#">
121
<i class="fab fa-github"></i>
122
</a>
123
</li>
124
125
<!-- Icon dropdown -->
126
<li class="nav-item dropdown">
127
<a
128
class="nav-link me-3 me-lg-0 dropdown-toggle hidden-arrow"
129
href="#"
130
id="navbarDropdown"
131
role="button"
132
data-mdb-toggle="dropdown"
133
aria-expanded="false"
134
>
135
<i class="united kingdom flag m-0"></i>
136
</a>
137
<ul
138
class="dropdown-menu dropdown-menu-end"
139
aria-labelledby="navbarDropdown"
140
>
141
<li>
142
<a class="dropdown-item" href="#"
143
><i class="united kingdom flag"></i>English
144
<i class="fa fa-check text-success ms-2"></i
145
></a>
146
</li>
147
<li><hr class="dropdown-divider" /></li>
148
<li>
149
<a class="dropdown-item" href="#"
150
><i class="poland flag"></i>Polski</a
151
>
152
</li>
153
<li>
154
<a class="dropdown-item" href="#"
155
><i class="china flag"></i>中文</a
156
>
157
</li>
158
<li>
159
<a class="dropdown-item" href="#"
160
><i class="japan flag"></i>日本語</a
161
>
162
</li>
163
<li>
164
<a class="dropdown-item" href="#"
165
><i class="germany flag"></i>Deutsch</a
166
>
167
</li>
168
<li>
169
<a class="dropdown-item" href="#"
170
><i class="france flag"></i>Français</a
171
>
172
</li>
173
<li>
174
<a class="dropdown-item" href="#"
175
><i class="spain flag"></i>Español</a
176
>
177
</li>
178
<li>
179
<a class="dropdown-item" href="#"
180
><i class="russia flag"></i>Русский</a
181
>
182
</li>
183
<li>
184
<a class="dropdown-item" href="#"
185
><i class="portugal flag"></i>Português</a
186
>
187
</li>
188
</ul>
189
</li>
190
191
<!-- Avatar -->
192
<li class="nav-item dropdown">
193
<a
194
class="nav-link dropdown-toggle hidden-arrow d-flex align-items-center"
195
href="#"
196
id="navbarDropdownMenuLink"
197
role="button"
198
data-mdb-toggle="dropdown"
199
aria-expanded="false"
200
>
201
<img
202
src="https://mdbcdn.b-cdn.net/img/Photos/Avatars/img (31).webp"
203
class="rounded-circle"
204
height="22"
205
alt="Avatar"
206
loading="lazy"
207
/>
208
</a>
209
<ul
210
class="dropdown-menu dropdown-menu-end"
211
aria-labelledby="navbarDropdownMenuLink"
212
>
213
<li><a class="dropdown-item" href="#">My profile</a></li>
214
<li><a class="dropdown-item" href="#">Settings</a></li>
215
<li><a class="dropdown-item" href="#">Logout</a></li>
216
</ul>
217
</li>
218
</ul>
219
</div>
220
<!-- Container wrapper -->
221
</nav>
222
<!-- Navbar -->
223
</header>
224
<!--Main Navigation-->
225
226
<!--Main layout-->
227
<main style="margin-top: 58px">
228
<div class="container">
229
230
</div>
231
</main>
232
<!--Main layout-->
233
234
<!--Footer-->
235
<footer></footer>
236
<!--Footer-->
xxxxxxxxxx
1
@media (min-width: 1400px) {
2
main,
3
header,
4
#main-navbar {
5
padding-left: 240px;
6
}
7
}
xxxxxxxxxx
1
const sidenav = document.getElementById("sidenav-4");
2
const sidenavInstance = mdb.Sidenav.getInstance(sidenav);
3
4
let innerWidth = null;
5
6
const setMode = (e) => {
7
// Check necessary for Android devices
8
if (window.innerWidth === innerWidth) {
9
return;
10
}
11
12
innerWidth = window.innerWidth;
13
14
if (window.innerWidth < 1400) {
15
sidenavInstance.changeMode("over");
16
sidenavInstance.hide();
17
} else {
18
sidenavInstance.changeMode("side");
19
sidenavInstance.show();
20
}
21
};
22
23
setMode();
24
25
// Event listeners
26
window.addEventListener("resize", setMode);
Console errors: 0