mirror of
https://github.com/rust-lang/mdBook
synced 2025-03-04 15:17:11 +00:00
Merge pull request #2017 from thanatos/roy/fix-sidebar
Default the sidebar to visible in large screens
This commit is contained in:
commit
c15220d1a1
1 changed files with 3 additions and 1 deletions
|
@ -92,10 +92,12 @@
|
|||
<!-- Hide / unhide sidebar before it is displayed -->
|
||||
<script>
|
||||
var html = document.querySelector('html');
|
||||
var sidebar = 'hidden';
|
||||
var sidebar = null;
|
||||
if (document.body.clientWidth >= 1080) {
|
||||
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
|
||||
sidebar = sidebar || 'visible';
|
||||
} else {
|
||||
sidebar = 'hidden';
|
||||
}
|
||||
html.classList.remove('sidebar-visible');
|
||||
html.classList.add("sidebar-" + sidebar);
|
||||
|
|
Loading…
Add table
Reference in a new issue