[英]Magnific popup not working properly
Magnific popup is working, but not the way I want it to. 华丽的弹出窗口正在工作,但不是我想要的方式。
Why is it not working? 为什么不起作用? Here is the jQuery code:
这是jQuery代码:
$('.view').click(function() {
$('.image-popup').magnificPopup({
type: 'image',
closeOnContentClick: true,
mainClass: 'mfp-img-mobile',
image: {
verticalFit: true
}
});
});
Why don't you change your html to : 为什么不将html更改为:
<div class="pic">
<a class="image-popup-fit-width" href="http://farm4.staticflickr.cm/3721/9207329484_ba28755ec4_o.jpg" title="This image fits only horizontally.">
<img src="pictureLink" width="75" height="75">
</a>
<p><a href="http://farm4.staticflickr.com/3721/9207329484_ba28755ec4_o.jpg" class="image-popup-fit-width">Click to view</a></p>
</div>
The anchor tag needs to have image-popup-fit-width class rather image-popup. 定位标记需要具有image-popup-fit-width类,而不是image-popup。
<a class="image-popup-fit-width" href="http://farm4.staticflickr.com/3721/9207329484_ba28755ec4_o.jpg" title="This image fits only horizontally.">
<img src="http://farm4.staticflickr.com/3721/9207329484_ba28755ec4_o.jpg" width="75" height="75">
</a>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.