Matt Evans
Matt Evans

Reputation: 7585

Magnific modal closes when clicking outside popup

The Magnific popup closes when clicking off the popup, with modal set to true.

      $(document).ready(function() {
    $.magnificPopup.open({
      items: {
        src: '<div class="white-popup">Our terms and conditions have changed. Please review them: <p><br><a class="popup-modal-dismiss" href="#">Got it</a></p></div>',
        type: 'inline',
        preloader: false,
        modal: true
      }
    });
    $(document).on('click', '.popup-modal-dismiss', function(e) {
      e.preventDefault();
      $.magnificPopup.close();
    });   
  });

http://codepen.io/anon/pen/YZrRyw

There is this post reporting a similar issue, but I am using the latest version in the pen

Upvotes: 0

Views: 439

Answers (1)

Saurabh Sharma
Saurabh Sharma

Reputation: 2462

You are making a little mistake, The configuration should not go within the items{...}.

$(document).ready(function() {
  $.magnificPopup.open({
    items: {
      src: '<div class="white-popup">Our terms and conditions have changed. Please review them: <p><br><a class="popup-modal-dismiss" href="#">Got it</a></p></div>',
      type: 'inline',
    },
    modal: true,
    preloader: false,
  });

});

Here's the updated codepen: http://codepen.io/anon/pen/EWwObY

Upvotes: 2

Related Questions