The below attributes in magnific popup will help you to close the popup window,

closeOnBgClick: if it is true, the popup will close whereever click on outside the content(black overlay). To prevent this, assign the value false to close only when click on X (close) button in top right cornor of popup. By defualt, true is assigned for this attribute.

enableEscapeKey: if it is true, the popup will close when click the escape key. To prevent this, assign the value false to close only when click on X (close) button in top right cornor of popup. By defualt, true is assigned for this.

Hope that these points may help you.!

Answer from Srinivasan.S on Stack Overflow
🌐
Dimsemenov
dimsemenov.com › plugins › magnific-popup › documentation.html
Magnific Popup Documentation
Close button will be automatically appended inside (if closeBtnInside:true). .white-popup { position: relative; background: #FFF; padding: 20px; width: auto; max-width: 500px; margin: 20px auto; }
🌐
GitHub
github.com › dimsemenov › Magnific-Popup › issues › 56
Option to disable closing on background/overlay click · Issue #56 · dimsemenov/Magnific-Popup
May 15, 2013 - Hi, From the code I have noticed that clicking on the background/overlay/modal area will always close the magnific popup. There is no option to disable that and I think it would be really useful if somebody was to use it as a prompt/conf...
🌐
Kriesi
kriesi.at › home › topics › enfold › stop magnific popup from closing when clicking background/overlay
Stop Magnific Popup from Closing when Clicking Background/Overlay - Support | Kriesi.at - Premium WordPress Themes
July 10, 2019 - You can no longer close the lightbox by clicking on the background. ... Thanks. I just visited the site and it works for other popups but not for the popup that i set to auto load when the homepage loads. Could you help with this. ... I edited the code for you.
🌐
GitHub
github.com › dimsemenov › Magnific-Popup › issues › 519
closeOnBgClick not closing popup when clicking on dark overlay · Issue #519 · dimsemenov/Magnific-Popup
August 5, 2014 - I have closeOnBgClick set to true, however the popup only closes when I hit esc or click the X marker. It should be closing when I click on the dark overlay. Does someone know how to fix this? I am using it with Rails if that makes a difference. ... defaults: { // Info about options is in docs: // http://dimsemenov.com/plugins/magnific-popup/documentation.html#options disableOn: 0, key: null, midClick: false, mainClass: '', preloader: true, focus: '', // CSS selector of input to focus after popup is opened closeOnContentClick: false, closeOnBgClick: true, closeBtnInside: false, showCloseBtn: true, enableEscapeKey: true, modal: false, alignTop: false, removalDelay: 0, fixedContentPos: 'auto', fixedBgPos: 'auto', overflowY: 'auto', closeMarkup: '<button title="%title%" type="button" class="mfp-close">&times;</button>', tClose: 'Close (Esc)', tLoading: 'Loading...'
Author   pwz2k
🌐
GitHub
github.com › dimsemenov › Magnific-Popup › issues › 463
modal unexpectedly closing on content click · Issue #463 · dimsemenov/Magnific-Popup
May 19, 2014 - <script type="text/javascript"> $(document).ready(function() { $('.simple-ajax-popup-align-top').magnificPopup({ type: 'ajax', closeOnContentClick: false, closeBtnInside: true, overflowY: 'scroll' // as we know that popup content is tall we set scroll overflow by default to avoid jump }); $('.simple-ajax-popup').magnificPopup({ type: 'ajax', closeOnContentClick: false }); }); </script>
Find elsewhere
🌐
GitHub
github.com › dimsemenov › Magnific-Popup › issues › 625
Clicking outside modal closes popup on mobile devices · Issue #625 · dimsemenov/Magnific-Popup
February 5, 2015 - When you set modal = true, you should not be able to close the popup by clicking outside the modal. This is working as expected on desktop. However, on mobile devices, you can click above or below the modal on the gray background and it will close.
Author   svetnicka
🌐
CodePen
codepen.io › dimsemenov › pen › DrmzyY
Custom action before close / Confirm closing
#open-popup {padding:20px} .white-popup { position: relative; background: #FFF; padding: 40px; width: auto; max-width: 200px; margin: 20px auto; text-align: center; } ... $('#open-popup').magnificPopup({ type:'inline', callbacks: { open: function() { // this part overrides "close" method in MagnificPopup object $.magnificPopup.instance.close = function () { if (!confirm("Are you sure?")) { return; } // "proto" variable holds MagnificPopup class prototype // The above change that we did to instance is not applied to the prototype, // which allows us to call parent method: $.magnificPopup.proto.close.call(this); }; // you may override any method like so, just note that it's applied globally } } });
🌐
GitHub
github.com › dimsemenov › Magnific-Popup › issues › 34
Click on any Ajax element close modal · Issue #34 · dimsemenov/Magnific-Popup
May 5, 2013 - The modal closes every time i click an element, button or toggle of the ajax loaded content.
Author   jarc100
🌐
Wordpress
cbabhusal.wordpress.com › 2014 › 09 › 30 › custom-close-button-magnific-popups-jquery
Custom Close button : Magnific Popups jQuery – My Daily Technical Notes [ Ruby, Rails, Gems, Server Ops]
March 7, 2015 - //Popup you opened using $.magnificPopup.open() $.magnificPopup.close(); }); If popup is triggered via onClick event then the same jQuery Object can be used to close that popup · $('#close-button-verify').click(function(){ $('#id_of_button_that_opend_popup').magnificPopup('close'); }); Click to share on X (Opens in new window) X ·
🌐
GitHub
github.com › dimsemenov › Magnific-Popup › issues › 122
Magnific Popup Callback when closing · Issue #122 · dimsemenov/Magnific-Popup
June 19, 2013 - Is there anyway to get confimation when user click or trying to close the Popup. This is my demo http://jsfiddle.net/K9Geq/ If user click cancel the Popup should remain as it is, Or if user click Ok, We need to close the Popup.
Author   mifas
🌐
Stack Overflow
stackoverflow.com › questions › 31426993 › magnific-popup-close-when-i-click-on-ajax-content
Magnific popup close when i click on ajax content
I put modal: true the popup can not close by clicking on background or try to add CloseButton still no work, even close button didn't show up · – Tim Tawan Jul 15, 2015 at 10:22 · @TAWAN I have updated my answer, So you can get solution.I hade same problem with this but I sort out with this.If you still not get out from it.Please check another code.Thanx · – Jigs Virani Jul 15, 2015 at 10:26 · or for close from Jquery var mgObj=$('your-selecter').magnificPopup({ // you options }); // code to close pop up on clicking a button $(document).on('click','button',function(){ if(mgObj) { mgObj.close(); } }); – Jigs Virani Jul 15, 2015 at 10:31 ·
🌐
Muffingroup
forum.muffingroup.com › betheme › discussion › 48897 › how-to-close-popup-window-with-a-content-button
How to close popup window with a content button? — Betheme Support Forum
August 14, 2019 - function is_catalogue(){ if ( is_page( array( 146, 2045 ) ) ) { ?> <script type='text/javascript'> jQuery(document).ready(function($) { $(function(){ $('div.ino-popup-win a.popup-link').click(); }); }); </script> <?php } } add_action('wp_head', 'is_catalogue'); </pre> I can use sessions or cookie here to show popup once. Everything is working good. But how to close modal from the button on it? 3\ That was easy in the morning: I realized that modal - is magnific product and try to add to onclick function: <pre> $.magnificPopup.close(); return false; </pre> That is all now - we have popup plugin ) Bryan ·