Skip to content

Commit

Permalink
Fixed #8, added onBeforeClose callback as suggested by @AnatolyRugalev
Browse files Browse the repository at this point in the history
  • Loading branch information
FlyingDR committed Feb 21, 2014
1 parent f877e57 commit 7182d4a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions jquery.the-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
closeOnEsc: true,
closeOnOverlayClick: true,

onBeforeClose: null,
onClose: null,
onOpen: null,

Expand Down Expand Up @@ -132,6 +133,12 @@
var overlay = $('.' + localOptions.overlayClass);
$.extend(localOptions, overlay.data(pluginNamespace+'.options'));

if ($.isFunction(localOptions.onBeforeClose)) {
if (localOptions.onBeforeClose(overlay, localOptions) === false) {
return;
}
}

if (!localOptions.cloning) {
if (!el) {
el = overlay.data(pluginNamespace+'.el');
Expand Down

0 comments on commit 7182d4a

Please sign in to comment.