2017-03-16 38 views
0

单击弹出框时,Magnific弹出框关闭,模式设置为true。单击外部弹出框时,Magnific模式关闭

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

回答

2

你正在一点点失误,配置不应该在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, 
    }); 

}); 

下面是更新codepen:http://codepen.io/anon/pen/EWwObY