单击外部弹出窗口时关闭 Magnific 模式

Magnific modal closes when clicking outside popup

单击弹出窗口时,Magnific 弹出窗口关闭,模式设置为 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

this post 报告了类似的问题,但我在笔中使用的是最新版本

你犯了一个小错误,配置不应该在 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,
  });

});

这是更新后的代码笔:http://codepen.io/anon/pen/EWwObY