Remember Main sidebar collapsed state
See original GitHub issueWhen collapsing the main left sidebar on a given page, how can the collapse state be ‘remembered’ for the other pages when they are loaded?
Removing the collapse class in the <body>
tag works, but shows first open then quickly closed, which is less than ideal.
Issue Analytics
- State:
- Created 8 years ago
- Comments:10
Top Results From Across the Web
How to remember the toggle state of the sidebar in AdminLTE3?
Adminlte3. Just simple add data-enable-remember="true" to your "pushmenu" button. Example code: <a class="nav-link" data-widget="pushmenu" ...
Read more >Persisting a sidebars expanded / collapsed state with React ...
Today we will be building a sidebar (side navigation bar) that can expand to show icons + text, and that can collapse to...
Read more >29813 - Collapse "My Sidebar" and its state is not remembered
What happens is that even when I bring the Main Sidebar splitter to a collapsed state, it seems to always think that its...
Read more >[AUI-3235] Sidebar should remember collapsed/expanded state ...
Description. The problem is, that sidebar doesn't remember its state when resizing window. Steps to reproduce: Make viewport wide. Collapse sidebar.
Read more >how to remember the toggle state of the sidebar menu
Tip! Add the sidebar-collapse class to the body tag to get this layout. You should combine this option with a fixed layout if...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, and thanks for this. I used your idea with session storage and came up with this code that doesn’t display animations. Trick is to handle
sidebar-collapse
very early, just after the body tag is loaded. This way there is no need to use CSS tricks…Interesting approach! I didn’t think of going the CSS route. The following is a javascript based solution in case somebody may find it useful.
Basically I went to the original
<body class="hold-transition skin-blue sidebar-mini sidebar-collapse">
tag from the template and added the ‘sidebar-collapse’ class, so the sidebar will always load collapsed by default. Next I added the following script snippet to each web page, just before the$(document).ready()
if there is one (but not inside of it).This takes care of the jittery animation, since it now expands when necessary, providing for a reasonably natural feel.