mirror of https://github.com/ColorlibHQ/AdminLTE
Add Collapsing, Expanding and Removing Events (#2024)
Add Collapsing, Expanding and Removing Eventspull/2062/head^2
parent
e691c465e3
commit
da1ec8ee33
|
@ -34,8 +34,11 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
var Event = {
|
var Event = {
|
||||||
|
collapsing: 'collapsing.boxwidget',
|
||||||
collapsed: 'collapsed.boxwidget',
|
collapsed: 'collapsed.boxwidget',
|
||||||
|
expanding: 'expanding.boxwidget',
|
||||||
expanded: 'expanded.boxwidget',
|
expanded: 'expanded.boxwidget',
|
||||||
|
removing: 'removing.boxwidget',
|
||||||
removed: 'removed.boxwidget'
|
removed: 'removed.boxwidget'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -60,6 +63,7 @@
|
||||||
|
|
||||||
BoxWidget.prototype.expand = function () {
|
BoxWidget.prototype.expand = function () {
|
||||||
var expandedEvent = $.Event(Event.expanded);
|
var expandedEvent = $.Event(Event.expanded);
|
||||||
|
var expandingEvent = $.Event(Event.expanding);
|
||||||
var collapseIcon = this.options.collapseIcon;
|
var collapseIcon = this.options.collapseIcon;
|
||||||
var expandIcon = this.options.expandIcon;
|
var expandIcon = this.options.expandIcon;
|
||||||
|
|
||||||
|
@ -75,11 +79,13 @@
|
||||||
$(this.element).children(Selector.body + ', ' + Selector.footer)
|
$(this.element).children(Selector.body + ', ' + Selector.footer)
|
||||||
.slideDown(this.options.animationSpeed, function () {
|
.slideDown(this.options.animationSpeed, function () {
|
||||||
$(this.element).trigger(expandedEvent);
|
$(this.element).trigger(expandedEvent);
|
||||||
}.bind(this));
|
}.bind(this))
|
||||||
|
.trigger(expandingEvent);
|
||||||
};
|
};
|
||||||
|
|
||||||
BoxWidget.prototype.collapse = function () {
|
BoxWidget.prototype.collapse = function () {
|
||||||
var collapsedEvent = $.Event(Event.collapsed);
|
var collapsedEvent = $.Event(Event.collapsed);
|
||||||
|
var collapsingEvent = $.Event(Event.collapsing);
|
||||||
var collapseIcon = this.options.collapseIcon;
|
var collapseIcon = this.options.collapseIcon;
|
||||||
var expandIcon = this.options.expandIcon;
|
var expandIcon = this.options.expandIcon;
|
||||||
|
|
||||||
|
@ -94,16 +100,19 @@
|
||||||
.slideUp(this.options.animationSpeed, function () {
|
.slideUp(this.options.animationSpeed, function () {
|
||||||
$(this.element).addClass(ClassName.collapsed);
|
$(this.element).addClass(ClassName.collapsed);
|
||||||
$(this.element).trigger(collapsedEvent);
|
$(this.element).trigger(collapsedEvent);
|
||||||
}.bind(this));
|
}.bind(this))
|
||||||
|
.trigger(expandingEvent);
|
||||||
};
|
};
|
||||||
|
|
||||||
BoxWidget.prototype.remove = function () {
|
BoxWidget.prototype.remove = function () {
|
||||||
var removedEvent = $.Event(Event.removed);
|
var removedEvent = $.Event(Event.removed);
|
||||||
|
var removingEvent = $.Event(Event.removing);
|
||||||
|
|
||||||
$(this.element).slideUp(this.options.animationSpeed, function () {
|
$(this.element).slideUp(this.options.animationSpeed, function () {
|
||||||
$(this.element).trigger(removedEvent);
|
$(this.element).trigger(removedEvent);
|
||||||
$(this.element).remove();
|
$(this.element).remove();
|
||||||
}.bind(this));
|
}.bind(this))
|
||||||
|
.trigger(removingEvent);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Private
|
// Private
|
||||||
|
|
Loading…
Reference in New Issue