I'm using the following tool for my gallery and I've created the following HTML code:

 <div class="galerie">
   <div><a class="popup" href="path-to-large-image"><img src="path-to-thumb"><p>legend</p></a></div>
   <div><a class="popup" href="path-to-large-image"><img src="path-to-thumb"><p>legend</p></a></div>
   <div><a class="popup" href="path-to-large-image"><img src="path-to-thumb"><p>legend</p></a></div>
 </div>

Now I'd like to group these elements into one gallery. I've tried with this JavaScript code:

 $('.popup').magnificPopup({
     delegate: 'a',
     type: 'image'
 });

Unfortunately this doesn't work. Can anyone help?

有帮助吗?

解决方案 2

Try

 $('.galerie').magnificPopup({
 delegate: 'a',
 type: 'image'
 });

You should call the all gallery not a single image.

其他提示

If anyone wants to know how to set up groups in magnific popup you need to use the 'gallery' option:

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

Source: http://dimsemenov.com/plugins/magnific-popup/documentation.html#gallery

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top