Skip to content

Commit e48fea1

Browse files
committed
Fix sidebar scrolling on mobile
1 parent 47bd5ac commit e48fea1

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

docs/v2/index.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@
128128
overflow-x: hidden;
129129
overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
130130
}
131+
@media screen and (max-width: 991px) {
132+
.sidebar .contents {
133+
position: fixed;
134+
}
135+
}
131136

132137
.nav-link.active,
133138
.nav-link.active, a:hover,
@@ -243,7 +248,7 @@
243248
<div class="container-fluid" id="top">
244249
<div class="row row-offcanvas row-offcanvas-left">
245250
<nav class="sidebar col-xs-12 col-lg-3 sidebar-offcanvas">
246-
<nav id="nav">
251+
<nav class="contents" id="contents">
247252
<ul class="nav">
248253
<li class="nav-item">
249254
<a href="#overview" class="nav-link active">Overview</a>
@@ -3244,7 +3249,7 @@ <h2 class="header">
32443249

32453250
# Initialize Scrollspy for sidebar navigation; http://v4-alpha.getbootstrap.com/components/scrollspy/
32463251
$('body').scrollspy
3247-
target: '#nav'
3252+
target: '#contents'
32483253
offset: Math.round $('main').css('padding-top').replace('px', '')
32493254

32503255
if window.location.hash?

documentation/v2/docs.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ $(document).ready ->
66

77
# Initialize Scrollspy for sidebar navigation; http://v4-alpha.getbootstrap.com/components/scrollspy/
88
$('body').scrollspy
9-
target: '#nav'
9+
target: '#contents'
1010
offset: Math.round $('main').css('padding-top').replace('px', '')
1111

1212
if window.location.hash?

documentation/v2/docs.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ svg {
110110
overflow-x: hidden;
111111
overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
112112
}
113+
@media screen and (max-width: 991px) {
114+
.sidebar .contents {
115+
position: fixed;
116+
}
117+
}
113118

114119
.nav-link.active,
115120
.nav-link.active, a:hover,

documentation/v2/nav.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<nav id="nav">
1+
<nav class="contents" id="contents">
22
<ul class="nav">
33
<li class="nav-item">
44
<a href="#overview" class="nav-link active">Overview</a>

0 commit comments

Comments
 (0)