Fix for sidebar collapse/expand and window resizing

This commit is contained in:
Deon George 2019-05-16 11:15:49 +10:00
parent c406c35ff7
commit 70a7142877
No known key found for this signature in database
GPG Key ID: 7670E8DC27415254
2 changed files with 15 additions and 5 deletions

View File

@ -4,7 +4,7 @@
@include('adminlte::layouts.partials.htmlheader')
@show
<body class="hold-transition sidebar-mini">
<body class="hold-transition sidebar-mini @if (Cookie::get('toggleState') === 'closed') {{ 'sidebar-collapse' }} @endif">
<div id="app">
<div class="wrapper">
@include('adminlte::layouts.partials.mainheader')

View File

@ -25,15 +25,25 @@
"use strict";
$("body").on("collapsed.lte.pushmenu", function(){
if($.AdminLTESidebarTweak.options.EnableRemember){
document.cookie = "toggleState=closed";
if($.AdminLTESidebarTweak.options.EnableRemember) {
document.cookie = "toggleState=closed;path=/";
$("body").delay(500).queue(function () {
window.dispatchEvent(new Event('resize'));
$(this).dequeue();
});
}
});
// @todo this is not firing.
$("body").on("expanded.lte.pushmenu", function(){
$("body").on("shown.lte.pushmenu", function(){
if($.AdminLTESidebarTweak.options.EnableRemember){
document.cookie = "toggleState=opened";
document.cookie = "toggleState=opened;path=/";
$("body").delay(500).queue(function () {
window.dispatchEvent(new Event('resize'));
$(this).dequeue();
});
}
});