Closed aitormendez closed 7 years ago
UPDATE: This works for two galleries:
$('#gallery-1').justifiedGallery({
rowHeight : 100,
margins : 3
}).on('jg.complete', function () {
$('#gallery-1').lightGallery({
thumbnail:true
});
});
$('#gallery-2').justifiedGallery({
rowHeight : 100,
margins : 3
}).on('jg.complete', function () {
$('#gallery-2').lightGallery({
thumbnail:true
});
});
Remeber, jQuery event handlers receive the target object in this
:
$(document).ready(function(){
$('.gallery').justifiedGallery({
lastRow : 'nojustify',
rowHeight : 100,
margins : 3
}).on('jg.complete', function(){
var $gallery = $(this);
$gallery.lightGallery({
thumbnail: true
});
// or just …
$(this).lightGallery({
thumbnail: true
});
});
});
Thank you for the help!
I got "this.lightGallery is not a function" error.
Sorry, I forgot to wrap this
to $(this)
, see updated answer above.
I noticed. I set the jQuery selector on my own :) but error persists.
Sorry! It works. I had a typo error.
Thank you so much for the help, really!
Just first gallery open the lightbox. Following galleries break the page.
This is the HTML markup:
This is the init:
Is it possible to get woking all galleries in a page with a generic selector (".gallery")?