Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reload gallery with new set of images #530

Closed
anantheswarg881 opened this issue Jan 5, 2017 · 4 comments
Closed

Reload gallery with new set of images #530

anantheswarg881 opened this issue Jan 5, 2017 · 4 comments

Comments

@anantheswarg881
Copy link

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!!

@sachinchoolur
Copy link
Owner

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

@anantheswarg881
Copy link
Author

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
    });

@sachinchoolur
Copy link
Owner

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.

@sachinchoolur
Copy link
Owner

Please reopen if the issue persists

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants