Commit e829c39d authored by Luke Bennett's avatar Luke Bennett

Tidy timeout and add jquery

parent 2bb3e4c6
import $ from 'jquery';
export default class Popover { export default class Popover {
constructor(trigger, content) { constructor(trigger, content) {
this.isOpen = false; this.isOpen = false;
...@@ -41,13 +43,15 @@ export default class Popover { ...@@ -41,13 +43,15 @@ export default class Popover {
} }
closePopoverMouseleave() { closePopoverMouseleave() {
setTimeout(() => { if (this.$popover.is(':hover') ||
if (this.$popover.is(':hover') || (this.$popover.siblings('.popover').length > 0 &&
(this.$popover.siblings('.popover').length > 0 && this.$popover.siblings('.popover').is(':hover'))) return;
this.$popover.siblings('.popover').is(':hover'))) return;
this.closePopover();
}
this.closePopover(); closePopoverMouseleaveDelayed() {
}, 1500); setTimeout(this.closePopoverMouseleave.bind(this), 1500);
} }
registerClickOpenListener() { registerClickOpenListener() {
...@@ -59,8 +63,8 @@ export default class Popover { ...@@ -59,8 +63,8 @@ export default class Popover {
} }
registerMouseleaveCloseListener() { registerMouseleaveCloseListener() {
this.$popover.on('mouseleave.glPopover.close', this.closePopoverMouseleave.bind(this)); this.$popover.on('mouseleave.glPopover.close', this.closePopoverMouseleaveDelayed.bind(this));
this.$popover.siblings('.popover').on('mouseleave.glPopover.close', this.closePopoverMouseleave.bind(this)); this.$popover.siblings('.popover').on('mouseleave.glPopover.close', this.closePopoverMouseleaveDelayed.bind(this));
} }
destroyMouseleaveCloseListener() { destroyMouseleaveCloseListener() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment