Magnific Popup closes when clicked anywhere

user5248 picture user5248 · Apr 22, 2014 · Viewed 15.4k times · Source

I don't get it, why does the Magnific Popup plugin closes the popup when I click anywhere on the popup. It has the X button in the corner designed that to do already. Anybody know how to fix it so that it closes only when I click on the X?

Code below:

Open

<script type="text/javascript">
      $(document).ready(function() {

        $('.simple-ajax-popup-align-top').magnificPopup({
          type: 'ajax',
          alignTop: 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'
        });

      });
    </script>

Answer

Srinivasan.S picture Srinivasan.S · Jun 3, 2014

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.!