Skip to content

Commit 9dbe09d

Browse files
committed
Make darkfish more responsive and readable on mobile devices
- Make the sidebar toggle fixed on all devices - Prevent default zooming on mobile devices - Improve sidebar opening on mobile devices
1 parent 95cc15b commit 9dbe09d

File tree

1 file changed

+49
-1
lines changed
  • lib/rdoc/generator/template/darkfish/css

1 file changed

+49
-1
lines changed

lib/rdoc/generator/template/darkfish/css/rdoc.css

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,8 @@ nav a:hover {
219219
#navigation-toggle {
220220
z-index: 1000;
221221
font-size: 2em;
222-
position: absolute;
222+
display: block;
223+
position: fixed;
223224
}
224225

225226
#navigation-toggle[aria-expanded="true"] {
@@ -265,6 +266,7 @@ main {
265266
font-size: 16px;
266267
line-height: 1.6;
267268
color: var(--text-color);
269+
box-sizing: border-box;
268270
}
269271

270272
@media (min-width: 1024px) {
@@ -715,4 +717,50 @@ main .attribute-access-type {
715717
font-family: var(--font-code);
716718
}
717719

720+
@media (max-width: 1023px) {
721+
body {
722+
font-size: 14px;
723+
}
724+
725+
nav {
726+
width: 100%;
727+
}
728+
729+
main {
730+
margin: 1em auto;
731+
padding: 0 1em;
732+
max-width: 100%;
733+
}
734+
735+
#navigation-toggle {
736+
top: 10px;
737+
right: 10px;
738+
z-index: 1001;
739+
}
740+
741+
#navigation-toggle[aria-expanded="true"] {
742+
left: auto;
743+
}
744+
745+
#navigation-toggle[aria-expanded="false"] {
746+
left: auto;
747+
}
748+
749+
#search-field {
750+
font-size: 16px; /* Prevents zoom on focus in iOS */
751+
}
752+
}
753+
754+
@media (max-width: 480px) {
755+
pre, code {
756+
font-size: 14px;
757+
}
758+
759+
table {
760+
display: block;
761+
overflow-x: auto;
762+
white-space: nowrap;
763+
}
764+
}
718765
/* @end */
766+

0 commit comments

Comments
 (0)