Close all flyovers on click outside a flyover
This commit is contained in:
parent
5042fdab54
commit
e9c189fa38
|
@ -15,7 +15,8 @@
|
|||
Icinga.EventListener.call(this, icinga);
|
||||
|
||||
this.on('rendered', this.onRendered, this);
|
||||
this.on('click', '.flyover-toggle', this.onClick, this);
|
||||
this.on('click', this.onClick, this);
|
||||
this.on('click', '.flyover-toggle', this.onClickFlyoverToggle, this);
|
||||
}
|
||||
|
||||
Flyover.prototype = new Icinga.EventListener();
|
||||
|
@ -33,6 +34,17 @@
|
|||
};
|
||||
|
||||
Flyover.prototype.onClick = function(event) {
|
||||
var $target = $(event.target);
|
||||
|
||||
if (! $target.closest('.flyover').length) {
|
||||
var _this = event.data.self;
|
||||
$target.closest('.container').find('.flyover.flyover-expanded .flyover-toggle').each(function() {
|
||||
_this.onClickFlyoverToggle({target: this});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Flyover.prototype.onClickFlyoverToggle = function(event) {
|
||||
var $flyover = $(event.target).closest('.flyover');
|
||||
|
||||
$flyover.toggleClass('flyover-expanded');
|
||||
|
|
Loading…
Reference in New Issue