Skip to content

Commit cf35e08

Browse files
authored
Merge pull request #181 from thomastanck/master
Use fixed positioning and remove overflow-x's for smoother scrolling …
2 parents c986b3a + f9101ca commit cf35e08

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

src/theme/book.css

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ table thead td {
3737
font-weight: 700;
3838
}
3939
.sidebar {
40-
position: absolute;
40+
position: fixed;
4141
left: 0;
4242
top: 0;
4343
bottom: 0;
@@ -99,7 +99,6 @@ table thead td {
9999
}
100100
.page-wrapper {
101101
position: absolute;
102-
overflow-y: auto;
103102
left: 315px;
104103
right: 0;
105104
top: 0;
@@ -134,7 +133,14 @@ table thead td {
134133
left: 0;
135134
bottom: 0;
136135
padding-right: 15px;
137-
overflow-y: auto;
136+
}
137+
@media only screen and (max-width: 400px) {
138+
.page {
139+
/* Only prevent horizontal scrolling on screens with less than 100px for the content
140+
A better way would be to somehow prevent horizontal scrolling all the time, but this causes scrolling problems on iOS Safari.
141+
Also, would be better to only enable horizontal scrolling when it is needed (content does not fit on page) but I have no idea how to do that. */
142+
overflow-x: hidden;
143+
}
138144
}
139145
.content {
140146
margin-left: auto;
@@ -205,7 +211,7 @@ table thead td {
205211
font-size: 2.5em;
206212
text-align: center;
207213
text-decoration: none;
208-
position: absolute;
214+
position: fixed;
209215
top: 50px /* Height of menu-bar */;
210216
bottom: 0;
211217
margin: 0;
@@ -244,7 +250,13 @@ table thead td {
244250
.nav-chapters:hover {
245251
text-decoration: none;
246252
}
247-
.previous {
253+
.sidebar-hidden .previous {
254+
left: 0;
255+
}
256+
.sidebar-visible .nav-chapters .previous {
257+
left: 300px;
258+
}
259+
.sidebar-visible .mobile-nav-chapters .previous {
248260
left: 0;
249261
}
250262
.next {

0 commit comments

Comments
 (0)