Fixed bug with initial sidebar state unknown
This commit is contained in:
@@ -3,18 +3,18 @@ $(document).ready(function() {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
$('.sidebar-menu .collapse, .sidebar-menu .collapsing').on('hide.bs.collapse', function() {
|
||||
$(this).prev().find('.fa').eq(1).removeClass('fa-angle-right').addClass('fa-angle-down');
|
||||
var states = JSON.parse(localStorage.getItem('sidebar-states') || {});
|
||||
var states = JSON.parse(localStorage.getItem('sidebar-states')) || {};
|
||||
states[this.id] = 0;
|
||||
localStorage.setItem('sidebar-states', JSON.stringify(states));
|
||||
});
|
||||
$('.sidebar-menu .collapse, sidebar-menu .collapsing').on('show.bs.collapse', function() {
|
||||
$(this).prev().find('.fa').eq(1).removeClass('fa-angle-down').addClass('fa-angle-right');
|
||||
var states = JSON.parse(localStorage.getItem('sidebar-states') || {});
|
||||
var states = JSON.parse(localStorage.getItem('sidebar-states')) || {};
|
||||
states[this.id] = 1;
|
||||
localStorage.setItem('sidebar-states', JSON.stringify(states));
|
||||
});
|
||||
|
||||
var states = JSON.parse(localStorage.getItem('sidebar-states') || {});
|
||||
var states = JSON.parse(localStorage.getItem('sidebar-states')) || {};
|
||||
Object.getOwnPropertyNames(states).forEach((elid) => {
|
||||
if (states[elid] === 1) {
|
||||
$('#' + elid).collapse('show');
|
||||
|
||||
Reference in New Issue
Block a user