Hi,
I want to be able to do this. I have a gallery with all images and on click of a button or link, I want to show only portraits or landscapes. I'm changing the array that is bound to lightgallery but how do i refresh/ reload gallery with new set of images?
Thanks!!
Hi @anantheswarg881 ,
You need to destroy and re-initiate lightGallery.
Demo: http://sachinchoolur.github.io/lightGallery/demos/methods.html
Let me know if you need any further explanations
Hi Sachin,
Thanks for your reply. The link you gave me helped. But not fully solved.
I'm binding the images of the gallery using an angular js controller. When I change the array, destroy gallery and instantiate it again, the gallery changes but when I click on an item, the older gallery with full set of images is shown in the pop up modal. so the thumbnails still contained the older data.
The following code changed the gallery data but not thumbnails. Is there a way to solve it?
$scope.activeImages = $scope.portfolioImages;
var gallery = $('#lightgallery');
gallery.data('lightGallery').destroy(true);
gallery.lightGallery({
thumbnail: true
});
I think the gallery is not properly destroyed. It is difficult to debug without seeing the actual code. If you can send me an isolated(jsfiddle, plunker) demo, I'll fix the issue and send you back.
Please reopen if the issue persists
Most helpful comment
Hi @anantheswarg881 ,
You need to destroy and re-initiate lightGallery.
Demo: http://sachinchoolur.github.io/lightGallery/demos/methods.html
Let me know if you need any further explanations