当我点击它关闭的弹出窗口的任何地方时,但它不应该这样做,它应该只在我点击X按钮时关闭。我正在使用Magnific Popup Plugin。作者的演示工作正常,但是当我在我的网站上实现插件时,它并不像演示那样工作。这对我造成了问题,因为如果我尝试点击弹出窗口中的任何链接,它会关闭弹出窗口而不是打开链接。
任何想法导致它的原因是什么?代码如下:
<script type="text/javascript">
$(document).ready(function() {
$('.simple-ajax-popup-align-top').magnificPopup({
type: 'ajax',
alignTop: true,
overflowY: 'scroll' // as we know that popup content is tall we set scroll overflow by default to avoid jump
});
$('.simple-ajax-popup').magnificPopup({
type: 'ajax'
});
});
</script>
<a class="simple-ajax-popup-align-top ajax-gal" href="test.html">test</a>
答案 0 :(得分:0)
有几种方法可以控制关闭行为。
closeOnContentClick: false, // if true, closes the popup if you click on it
closeOnBgClick: true, // if true, closes the popup if you click on the grey stuff around it
showCloseBtn: false, //if true, shows a closing button top right.
您可以在此处详细了解这些选项:http://dimsemenov.com/plugins/magnific-popup/documentation.html#options
因为你是一个懒惰的程序员:
<script type="text/javascript">
$(document).ready(function() {
$('.simple-ajax-popup-align-top').magnificPopup({
type: 'ajax',
alignTop: true,
closeOnContentClick: false,
closeOnBgClick: true,
showCloseBtn: false,
overflowY: 'scroll' // as we know that popup content is tall we set scroll overflow by default to avoid jump
});
$('.simple-ajax-popup').magnificPopup({
type: 'ajax',
closeOnContentClick: false,
closeOnBgClick: true,
showCloseBtn: false
});
});
</script>