Skip to content Skip to sidebar Skip to footer

Isotope Filters To Only Display Filtered Light Gallery Images

I wanted to create a filtering portfolio for my website, I've got everything setup but the thing is, When I use Isotope to filter a category, of course it filters out but when I cl

Solution 1:

If you create a closure when you initialize lightGallery, you can use the API to destroy the current instance and re-initialize when you click the isotope filter buttons.

Create a closure and initialize lightGallery

$gallery = $('#gallery'); 

$gallery.lightGallery({...});

And when you click on the isotope filter button, destroy that instance and re-initialize based on the class of the elements you want to be in the gallery. That class is filterValue here

$gallery.data('lightGallery').destroy(true);

$gallery.lightGallery({
  selector: filterValue.replace('*','');
});

http://codepen.io/mcoker/pen/KaWKvE

Post a Comment for "Isotope Filters To Only Display Filtered Light Gallery Images"