Commit e829c39d authored by Luke Bennett's avatar Luke Bennett

Tidy timeout and add jquery

parent 2bb3e4c6
import $ from 'jquery';
export default class Popover {
constructor(trigger, content) {
this.isOpen = false;
......@@ -41,13 +43,15 @@ export default class Popover {
}
closePopoverMouseleave() {
setTimeout(() => {
if (this.$popover.is(':hover') ||
(this.$popover.siblings('.popover').length > 0 &&
this.$popover.siblings('.popover').is(':hover'))) return;
if (this.$popover.is(':hover') ||
(this.$popover.siblings('.popover').length > 0 &&
this.$popover.siblings('.popover').is(':hover'))) return;
this.closePopover();
}
this.closePopover();
}, 1500);
closePopoverMouseleaveDelayed() {
setTimeout(this.closePopoverMouseleave.bind(this), 1500);
}
registerClickOpenListener() {
......@@ -59,8 +63,8 @@ export default class Popover {
}
registerMouseleaveCloseListener() {
this.$popover.on('mouseleave.glPopover.close', this.closePopoverMouseleave.bind(this));
this.$popover.siblings('.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.closePopoverMouseleaveDelayed.bind(this));
}
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