2017-03-16 40 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