Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onBeforeClose gets triggered on open #3

Open
kaittodesk opened this issue Nov 6, 2014 · 0 comments
Open

onBeforeClose gets triggered on open #3

kaittodesk opened this issue Nov 6, 2014 · 0 comments

Comments

@kaittodesk
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant