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

trigger onclose event #70

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
28 changes: 15 additions & 13 deletions jquery.bpopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,20 @@
};

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();
return false; // Prevent default
};

function reposition(animateSpeed){
Expand Down Expand Up @@ -294,6 +295,7 @@
} else {
$popup.hide();
triggerCall(o.onClose);
$popup.trigger("close")
if (o.loadUrl) {
o.contentContainer.empty();
$popup.css({height: 'auto', width: 'auto'});
Expand Down