From 7182d4ac0bdce27da8a4e221ac33846a2a07f2f0 Mon Sep 17 00:00:00 2001 From: Alexander Grimalovsky Date: Fri, 21 Feb 2014 23:41:50 +0400 Subject: [PATCH] Fixed #8, added onBeforeClose callback as suggested by @AnatolyRugalev --- jquery.the-modal.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jquery.the-modal.js b/jquery.the-modal.js index 77d8c23..0f02a4b 100644 --- a/jquery.the-modal.js +++ b/jquery.the-modal.js @@ -18,6 +18,7 @@ closeOnEsc: true, closeOnOverlayClick: true, + onBeforeClose: null, onClose: null, onOpen: null, @@ -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');