Add Collapse Memory for sidebar on LargeBreakpoint

This commit is contained in:
Silversthorn 2022-10-06 07:52:24 +02:00
parent 002d89934e
commit 905be275ed
2 changed files with 7 additions and 3 deletions

View File

@ -197,6 +197,12 @@ if ($("canvas").length) {
!body.hasClass("sidebar-icon-only")
);
}
if (vw >= 992 && vw < 1200) {
localStorage.setItem(
"crafty-sidebar-expanded",
!body.hasClass("sidebar-icon-only")
);
}
}
});

View File

@ -53,12 +53,10 @@
More code in `app/frontend/static/assets/js/shared/misc.js` and `app/frontend/templates/base.html`
*/
if (isExtraLargeBreakpoint()) {
if (isLargeBreakpoint()) {
let value = localStorage.getItem('crafty-sidebar-expanded') !== 'false';
$('body').toggleClass('sidebar-icon-only', !value);
localStorage.setItem('crafty-sidebar-expanded', value);
} else if (isLargeBreakpoint()) {
$('body').toggleClass('sidebar-icon-only', true);
}
}
</script>