From 55d25c17e4ee451d90ee65b8ee6d6075750fc4f6 Mon Sep 17 00:00:00 2001 From: timgroote Date: Mon, 14 Mar 2016 14:19:35 +0100 Subject: [PATCH 1/5] trigger close event on close. fires a jquery style event using trigger when the popup closes. --- jquery.bpopup.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/jquery.bpopup.js b/jquery.bpopup.js index 1586abe..0f9f2fd 100644 --- a/jquery.bpopup.js +++ b/jquery.bpopup.js @@ -130,19 +130,21 @@ }; function close() { - if (o.modal) { - $('.b-modal.'+$popup.data('id')) - .fadeTo(o.speed, 0, function() { - $(this).remove(); - }); - } - // Clean up - unbindEvents(); - clearTimeout(autoCloseTO); - // Close trasition - doTransition(); - - return false; // Prevent default + if (o.modal) + { + $('.b-modal.'+$popup.data('id')) + .fadeTo(o.speed, 0, function() + { + $(this).remove(); + }); + } + // Clean up + unbindEvents(); + clearTimeout(autoCloseTO); + // Close trasition + doTransition(); + $(this).trigger("close"); + return false; // Prevent default }; function reposition(animateSpeed){ From 840d520dbebb466ec11c29fbae5ef3c532e2d931 Mon Sep 17 00:00:00 2001 From: timgroote Date: Mon, 14 Mar 2016 14:21:38 +0100 Subject: [PATCH 2/5] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 628bd75..900cbe6 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,12 @@ http://dinbror.dk/blog/bpopup bPopup is a lightweight jQuery modal popup plugin (only 1.34KB gzipped). It doesn't create or style your popup but provides you with all the logic like centering, modal overlay, events and more. It gives you a lot of opportunities to customize so it will fit your needs. ## CHANGELOG + +### v 0.11.1 (14-3-2016) ### (T. Groote) +* Trigger a close event when the popup is dismissed. you can subscribe to it using the return value of the bPopup() function. +* example : $("#popupContent").bPopup().on("close", function(){alert("closed!")}); + + ### v 0.11.0 (01-24-2015) ### * Fixed [#7](https://github.com/dinbror/bpopup/issues/7) and [#21](https://github.com/dinbror/bpopup/issues/21). Using fallback width as default to fix the width issue when scrollbar visible. * Fixed [#8](https://github.com/dinbror/bpopup/issues/8) and [#17](https://github.com/dinbror/bpopup/issues/17). "insideWindow" function updated so it now checks if height OR width is inside window instead of only width AND height. From f1ac4ea8daa1fd95b74c1012ec257cc92a9108e6 Mon Sep 17 00:00:00 2001 From: timgroote Date: Mon, 14 Mar 2016 14:22:15 +0100 Subject: [PATCH 3/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 900cbe6..721580c 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ bPopup is a lightweight jQuery modal popup plugin (only 1.34KB gzipped). It does ### v 0.11.1 (14-3-2016) ### (T. Groote) * Trigger a close event when the popup is dismissed. you can subscribe to it using the return value of the bPopup() function. -* example : $("#popupContent").bPopup().on("close", function(){alert("closed!")}); + example : ```javascript $("#popupContent").bPopup().on("close", function(){alert("closed!")}); ``` ### v 0.11.0 (01-24-2015) ### From 73494be3fd99b846785a78ad045d9ffbd41bd2d0 Mon Sep 17 00:00:00 2001 From: timgroote Date: Mon, 14 Mar 2016 14:22:31 +0100 Subject: [PATCH 4/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 721580c..6c29e8e 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ bPopup is a lightweight jQuery modal popup plugin (only 1.34KB gzipped). It does ### v 0.11.1 (14-3-2016) ### (T. Groote) * Trigger a close event when the popup is dismissed. you can subscribe to it using the return value of the bPopup() function. - example : ```javascript $("#popupContent").bPopup().on("close", function(){alert("closed!")}); ``` + example : ```$("#popupContent").bPopup().on("close", function(){alert("closed!")}); ``` ### v 0.11.0 (01-24-2015) ### From 130f72b05efaca991629d1a4129561cad70682cb Mon Sep 17 00:00:00 2001 From: timgroote Date: Mon, 14 Mar 2016 14:51:25 +0100 Subject: [PATCH 5/5] Update jquery.bpopup.js fixed wrong element firing close event --- jquery.bpopup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.bpopup.js b/jquery.bpopup.js index 0f9f2fd..7054cbd 100644 --- a/jquery.bpopup.js +++ b/jquery.bpopup.js @@ -143,7 +143,6 @@ clearTimeout(autoCloseTO); // Close trasition doTransition(); - $(this).trigger("close"); return false; // Prevent default }; @@ -296,6 +295,7 @@ } else { $popup.hide(); triggerCall(o.onClose); + $popup.trigger("close") if (o.loadUrl) { o.contentContainer.empty(); $popup.css({height: 'auto', width: 'auto'});