Skip to content

Commit

Permalink
usePopupEasyClose fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
aj committed Dec 16, 2014
1 parent ab5156d commit 69f56a9
Showing 1 changed file with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions jquery.poptrox.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
popupHeight: 100, // Popup height
popupIsFixed: false, // If true, popup won't resize to fit images
useBodyOverflow: false, // If true, the BODY tag is set to overflow: hidden when the popup is visible
usePopupEasyClose: true, // If true, popup can be closed by clicking on it anywhere
usePopupEasyClose: false, // If true, popup can be closed by clicking on it anywhere
usePopupForceClose: false, // If true, popup can be closed even while content is loading
usePopupLoader: true, // If true, show the popup loader
usePopupCloser: true, // If true, show the popup closer button/link
Expand Down Expand Up @@ -325,26 +325,12 @@

});

if (settings.usePopupEasyClose) {

$pic
.css('cursor', 'pointer')
.on('click', function(e) {

e.preventDefault();
e.stopPropagation();

$popup.trigger('poptrox_close');

});

}

$popup
.css('display', 'inline-block')
.css('vertical-align', 'middle')
.css('position', 'relative')
.css('z-index', 1)
.css('cursor', 'auto')
.appendTo($overlay)
.hide()
.on('poptrox_next', function() {
Expand Down Expand Up @@ -541,6 +527,30 @@
})
.trigger('poptrox_reset');

// Easy close.
if (settings.usePopupEasyClose) {

$caption.on('click', 'a', function(e) {
e.stopPropagation();
});

$popup
.css('cursor', 'pointer')
.on('click', function(e) {

e.stopPropagation();
e.preventDefault();

$popup.trigger('poptrox_close');

});
}
else
$popup
.on('click', function(e) {
e.stopPropagation();
});

$window
.keydown(function(e) {

Expand Down

0 comments on commit 69f56a9

Please sign in to comment.