xxxxxxxxxx
1
<!-- Sidenav -->
2
<nav
3
id="sidenav-1"
4
class="sidenav"
5
data-mdb-right="true"
6
data-mdb-position="absolute"
7
>
8
<ul class="sidenav-menu">
9
<li class="sidenav-item">
10
<a class="sidenav-link">
11
<i class="far fa-smile fa-fw me-3"></i><span>Link 1</span></a
12
>
13
</li>
14
<li class="sidenav-item">
15
<a class="sidenav-link"
16
><i class="fas fa-grin fa-fw me-3"></i><span>Category 1</span></a
17
>
18
<ul class="sidenav-collapse show">
19
<li class="sidenav-item">
20
<a class="sidenav-link">Link 2</a>
21
</li>
22
<li class="sidenav-item">
23
<a class="sidenav-link">Link 3</a>
24
</li>
25
</ul>
26
</li>
27
<li class="sidenav-item">
28
<a class="sidenav-link"
29
><i class="fas fa-grin-wink fa-fw me-3"></i><span>Category 2</span></a
30
>
31
<ul class="sidenav-collapse">
32
<li class="sidenav-item">
33
<a class="sidenav-link">Link 4</a>
34
</li>
35
<li class="sidenav-item">
36
<a class="sidenav-link"
37
>Link 5</a
38
>
39
</li>
40
</ul>
41
</li>
42
</ul>
43
</nav>
44
<!-- Sidenav -->
45
46
<!-- Toggler -->
47
<button
48
data-mdb-toggle="sidenav"
49
data-mdb-target="#sidenav-1"
50
class="btn btn-primary"
51
aria-controls="#sidenav-1"
52
aria-haspopup="true"
53
>
54
<i class="fas fa-bars"></i>
55
</button>
56
<!-- Toggler -->
57
<h1 style="margin-top:800px;">Example div 1</h1>
58
<h1 style="margin-top:800px;">Example div 2</h1>
59
<h1 style="margin-top:800px;">Example div 3</h1>
60
61
xxxxxxxxxx
1
body {
2
position: relative !important;
3
overflow-x: hidden;
4
}
5
.sidenav-backdrop {
6
position: fixed !important;
7
}
8
9
#sidenav-1 {
10
height: calc(100% + 5px) !important;
11
}
xxxxxxxxxx
1
document.addEventListener('hide.mdb.sidenav', (e) => {
2
const scrollY = window.scrollY
3
4
setTimeout(() => {
5
window.scrollTo(0, scrollY)
6
}, 0)
7
})
Console errors: 0