fixed collapsed sidebar autocollapse bug (#2339)

This commit is contained in:
Raphael Jackstadt
2019-10-19 12:01:46 +02:00
committed by GitHub
parent 14967aec94
commit 829a9b3c6c
5 changed files with 15 additions and 11 deletions

View File

@@ -71,7 +71,7 @@ const PushMenu = (($) => {
$(Selector.BODY).removeClass(ClassName.COLLAPSED) $(Selector.BODY).removeClass(ClassName.COLLAPSED)
if(this._options.enableRemember) { if(this._options.enableRemember) {
localStorage.setItem(`remember${EVENT_KEY}`, ClassName.OPEN) localStorage.setItem(`remember${EVENT_KEY}`, ClassName.OPEN)
} }
const shownEvent = $.Event(Event.SHOWN) const shownEvent = $.Event(Event.SHOWN)
@@ -88,7 +88,7 @@ const PushMenu = (($) => {
$(Selector.BODY).addClass(ClassName.COLLAPSED) $(Selector.BODY).addClass(ClassName.COLLAPSED)
if(this._options.enableRemember) { if(this._options.enableRemember) {
localStorage.setItem(`remember${EVENT_KEY}`, ClassName.COLLAPSED) localStorage.setItem(`remember${EVENT_KEY}`, ClassName.COLLAPSED)
} }
const collapsedEvent = $.Event(Event.COLLAPSED) const collapsedEvent = $.Event(Event.COLLAPSED)
@@ -103,13 +103,13 @@ const PushMenu = (($) => {
} }
} }
autoCollapse() { autoCollapse(resize = false) {
if (this._options.autoCollapseSize) { if (this._options.autoCollapseSize) {
if ($(window).width() <= this._options.autoCollapseSize) { if ($(window).width() <= this._options.autoCollapseSize) {
if (!$(Selector.BODY).hasClass(ClassName.OPEN)) { if (!$(Selector.BODY).hasClass(ClassName.OPEN)) {
this.collapse() this.collapse()
} }
} else { } else if (resize == true) {
if (!$(Selector.BODY).hasClass(ClassName.OPEN)) { if (!$(Selector.BODY).hasClass(ClassName.OPEN)) {
this.show() this.show()
} else { } else {
@@ -151,7 +151,7 @@ const PushMenu = (($) => {
this.autoCollapse() this.autoCollapse()
$(window).resize(() => { $(window).resize(() => {
this.autoCollapse() this.autoCollapse(true)
}) })
} }

10
dist/js/adminlte.js vendored
View File

@@ -552,13 +552,17 @@
} }
}; };
_proto.autoCollapse = function autoCollapse() { _proto.autoCollapse = function autoCollapse(resize) {
if (resize === void 0) {
resize = false;
}
if (this._options.autoCollapseSize) { if (this._options.autoCollapseSize) {
if ($(window).width() <= this._options.autoCollapseSize) { if ($(window).width() <= this._options.autoCollapseSize) {
if (!$(Selector.BODY).hasClass(ClassName.OPEN)) { if (!$(Selector.BODY).hasClass(ClassName.OPEN)) {
this.collapse(); this.collapse();
} }
} else { } else if (resize == true) {
if (!$(Selector.BODY).hasClass(ClassName.OPEN)) { if (!$(Selector.BODY).hasClass(ClassName.OPEN)) {
this.show(); this.show();
} else { } else {
@@ -601,7 +605,7 @@
this.remember(); this.remember();
this.autoCollapse(); this.autoCollapse();
$(window).resize(function () { $(window).resize(function () {
_this.autoCollapse(); _this.autoCollapse(true);
}); });
}; };

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long