【问题标题】:Magnific modal closes when clicking outside popup单击外部弹出窗口时,放大模式关闭
【发布时间】:2017-03-16 07:19:31
【问题描述】:

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 报告了类似问题,但我使用的是最新版本

【问题讨论】:

    标签: javascript magnific-popup


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2021-11-21
      • 2018-08-20
      • 2019-11-10
      • 1970-01-01
      • 1970-01-01
      • 2023-03-22
      • 1970-01-01
      • 1970-01-01
      • 2012-12-21
      相关资源
      最近更新 更多