简体   繁体   English

Magnific-Popup Gallery在一个标签中包含两个图像标签

[英]Magnific-Popup Gallery with two image tag in a single a tag

I'm making a gallery with Magnific-Popup but for speed up my website i've inside the a tag two different image. 我正在使用Magnific-Popup创建一个画廊,但是为了加快我的网站的速度,我在一个标签中放置了两个不同的图像。 One for big screen and another one for small screen. 一个用于大屏幕,另一个用于小屏幕。 I'm hidding one or the other one image with bootstrap class (hidden-lg hidden-md & hidden-sm hidden-xs). 我用bootstrap类(hidden-lg hidden-md和hidden-sm hidden-xs)隐藏一个或另一个图像。

The problem is that when i click on the a tag to open the image gallery, Magnific-Popup try to open hidden image and return "the image could not be loaded". 问题是,当我单击一个标签以打开图像库时,Magnific-Popup尝试打开隐藏的图像并返回“图像无法加载”。

 <li> <figure> <div class="gallery-item"> <a href="assets/upload/images/romantic/clem-onojeghuo-193397.jpg" title="" class="gallery-item"> <img src="/assets/image-cache/romantic/clem-onojeghuo-193397.5ddf5942.jpg" alt="" class="hidden-lg hidden-md"> <img src="/assets/image-cache/romantic/clem-onojeghuo-193397.36620614.jpg" alt="" class="hidden-sm hidden-xs"> <div class="gallery-caption"> <div class="centrize"> <div class="v-center"><i class="hc-search"></i></div> </div> </div> </a> </div> </figure> </li> 

 $('.gallery-item').magnificPopup({ type: 'image', gallery:{ enabled:true } }); 

It was my own error because i've two time the "gallery-item" class. 这是我自己的错误,因为我有两次参加“画廊项目”课程。 One on the div tag and the other on the a tag. 一个在div标签上,另一个在a标签上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM