ender-overlay icon indicating copy to clipboard operation
ender-overlay copied to clipboard

onBeforeClose gets triggered on open

Open kaittodesk opened this issue 11 years ago • 0 comments

For example, if I create an overlay with following code

var box = $('#overlay').overlay({
  allowMultipleDisplay: false, // Also the default value.
  onBeforeClose: function() {
    console.log("Close triggered");
  }
});

// Opening the 'box' will output "Close triggered" to console.
box.open();
> "Close triggered"

I did a little digging and found that this if clause

if (opt.onBeforeClose(api) === false ||
  this.$overlay.css('display') !== 'block') {
  return;
}

executes onBeforeClose function regardless of overlay's current visibility state.

I think the conditions in the if clause should be the other way around (like they are for onBeforeOpen function). What do you think?

kaittodesk avatar Nov 06 '14 14:11 kaittodesk