StartBootstrap / startbootstrap-simple-sidebar

An off canvas sidebar navigation Bootstrap HTML template created by Start Bootstrap

Home Page:https://startbootstrap.com/template/simple-sidebar/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue in persist sidebar toggle between refreshes

rajeshvaishnav opened this issue · comments

when we enable this code and toggled sidebar

if (localStorage.getItem('sb|sidebar-toggle') === 'true') {
document.body.classList.toggle('sb-sidenav-toggled');
}

after that when we hit refresh the sidebar comes for a second, I want when sidebar toggled its will completely hidden when refresh the page (right now its comes for second ) can you please suggest any solution for this issue.

please check attached gif file for more clarification.

Profile-20210531T100719

I changed the css so that it does not flow sideways anymore. I think the design is that it's supposed to work that way. I hope this solution helps you.

Greets,

Mark

.sb-sidenav-toggled #layoutSidenav #layoutSidenav_nav {
/* Changed sidenac toggle transition, now just hides the navbar with margin-left. The transform is outcommented /
margin-left: -225px;
/
transform: translateX(0); */
}

@media (min-width: 992px) {
#layoutSidenav #layoutSidenav_nav {
transform: translateX(0);
}
#layoutSidenav #layoutSidenav_content {
/* Changed sidenac toggle transition, now just hides the navbar with by commenting out transition /
margin-left: 0;
/
transition: margin 0.15s ease-in-out; */
}

I changed the css so that it does not flow sideways anymore. I think the design is that it's supposed to work that way. I hope this solution helps you.

Greets,

Mark

.sb-sidenav-toggled #layoutSidenav #layoutSidenav_nav { /* Changed sidenac toggle transition, now just hides the navbar with margin-left. The transform is outcommented / margin-left: -225px; / transform: translateX(0); */ }

@media (min-width: 992px) { #layoutSidenav #layoutSidenav_nav { transform: translateX(0); } #layoutSidenav #layoutSidenav_content { /* Changed sidenac toggle transition, now just hides the navbar with by commenting out transition / margin-left: 0; / transition: margin 0.15s ease-in-out; */ }

couldn't understand, couldn't find those classes

I changed the css so that it does not flow sideways anymore. I think the design is that it's supposed to work that way. I hope this solution helps you.
Greets,
Mark
.sb-sidenav-toggled #layoutSidenav #layoutSidenav_nav { /* Changed sidenac toggle transition, now just hides the navbar with margin-left. The transform is outcommented / margin-left: -225px; / transform: translateX(0); / }
@media (min-width: 992px) { #layoutSidenav #layoutSidenav_nav { transform: translateX(0); } #layoutSidenav #layoutSidenav_content { /
Changed sidenac toggle transition, now just hides the navbar with by commenting out transition / margin-left: 0; / transition: margin 0.15s ease-in-out; */ }

couldn't understand, couldn't find those classes

You can find these in the styles.css. Good luck!