Permalink
Browse files

Merge pull request #437 from jefferyto/patch-1

Check ancestors when close button is clicked
  • Loading branch information...
ChubbyNinja committed Apr 12, 2017
2 parents 6b7a808 + 7aa5f0c commit 92c92875b21020f5e73e8ae01d94521a06877ee2
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/js/core.js
View
@@ -695,7 +695,7 @@ MagnificPopup.prototype = {
// "target" is an element that was clicked
_checkIfClose: function(target) {
if($(target).hasClass(PREVENT_CLOSE_CLASS)) {
if($(target).closest('.' + PREVENT_CLOSE_CLASS).length) {
return;
}
@@ -707,7 +707,7 @@ MagnificPopup.prototype = {
} else {
// We close the popup if click is on close button or on preloader. Or if there is no content.
if(!mfp.content || $(target).hasClass('mfp-close') || (mfp.preloader && target === mfp.preloader[0]) ) {
if(!mfp.content || $(target).closest('.mfp-close').length || (mfp.preloader && target === mfp.preloader[0]) ) {
return true;
}

0 comments on commit 92c9287

Please sign in to comment.