How can I limit magnific-popup gallery to direct siblings? When I open an image from the first .child, I don’t want the images from the second .child to be in the gallery.
The html structure:
<div class="parent">
<div class="child">
<a class="image-link" href="img/red1.jpg"><img src="img/red1.jpg"></a>
<a class="image-link" href="img/red2.jpg"><img src="img/red2.jpg"></a>
<a class="image-link" href="img/red3.jpg"><img src="img/red3.jpg"></a>
<a class="image-link" href="img/red4.jpg"><img src="img/red4.jpg"></a>
<a class="image-link" href="img/red5.jpg"><img src="img/red5.jpg"></a>
</div>
<div class="child">
<a class="image-link" href="img/city1.jpg"><img src="img/city1.jpg"></a>
<a class="image-link" href="img/city2.jpg"><img src="img/city2.jpg"></a>
<a class="image-link" href="img/city3.jpg"><img src="img/city3.jpg"></a>
<a class="image-link" href="img/city4.jpg"><img src="img/city4.jpg"></a>
<a class="image-link" href="img/city5.jpg"><img src="img/city5.jpg"></a>
</div>
</div>
how I initialize Magnific-Popup:
$('.child').magnificPopup({
delegate: '.image-link',
type:'image',
gallery: {
enabled: true
}
});
If delegate
option is used, only like so:
$('.child').each(function() {
$(this).magnificPopup({
delegate: '.image-link',
type:'image',
gallery: {
enabled: true
}
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With