【发布时间】:2019-06-01 00:29:33
【问题描述】:
我想从缩略图列表中打开一个宏伟的弹出式画廊。
画廊打开一次,一切正常,但如果我关闭画廊,我无法打开两次,我有这个错误:
未捕获的类型错误:无法读取未定义的属性“顶部”
magnific-popup.js 中这一行的错误报告: offset.top -= ( $(window).scrollTop() - paddingTop );
<div id="filelist">
<div id="156" class="entreprise_img" style="background: url('5c30ff09d7566.jpg') no-repeat center;-moz-background-size: cover;-webkit-background-size: cover;background-size: cover;">
<a href="#" class="entreprise_photo_btn_delete" title="Supprimer">Supprimer</a>
<a href="5c30ff09d7566.jpg" class="magnific-gallery" style="position: absolute; bottom: 0;">VOIR</a>
</div>
<div id="157" class="entreprise_img" style="background: url('5c3104cab1fb7.jpg') no-repeat center;-moz-background-size: cover;-webkit-background-size: cover;background-size: cover;">
<a href="#" class="entreprise_photo_btn_delete" title="Supprimer">Supprimer</a>
<a href="5c3104cab1fb7.jpg" class="magnific-gallery" style="position: absolute; bottom: 0;">VOIR</a>
</div>
</div>
$('#filelist').each(function(){
$(this).magnificPopup({
delegate: '.magnific-gallery',
type: 'image',
closeOnContentClick: false,
closeBtnInside: false,
mainClass: 'mfp-with-zoom mfp-img-mobile',
image: {
verticalFit: true
},
gallery: {
enabled: true
},
zoom: {
enabled: true,
duration: 300, // don't foget to change the duration also in CSS
opener: function(element) {
return element.find('img');
}
}
});
});
【问题讨论】:
-
删除缩放选项后一切正常。
标签: jquery gallery lightbox magnific-popup