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

Images loaded by ajax #129

Closed
rafasegat opened this issue Jun 16, 2015 · 4 comments
Closed

Images loaded by ajax #129

rafasegat opened this issue Jun 16, 2015 · 4 comments

Comments

@rafasegat
Copy link

Hey,

I have a issue. My gallery and LightGallery are working perfectly but I have a Load More button that load more photos using ajax. So I call LightGallery function again and does not work well.

Example
http://instagramwordpress.rafsegat.com/

Thanks so much and beautiful plugin BTW

@rafasegat
Copy link
Author

Any answer?

@sachinchoolur
Copy link
Owner

Hi,
You have to destroy the plugin and re-initiate it after clicking on load more button.

var gallery = $('#gallery').lightGallery();

$('#load-more').on('click', function() {
    gallery.destroy();
    gallery = $('#gallery').lightGallery();
});

@rafasegat
Copy link
Author

Thanks so much sachinchoolur!

That was a huge issue on my plugin and now its working fine.

I`ll put considerations and show LightGallery plugin on my codecanyon plugin page

Thanks so much!
Raf

@awplige
Copy link

awplige commented Aug 7, 2018

Finally I got resolved my problem in ajax load more new images into lightgallery:

var $lg = jQuery('div#animated-thumbnials'); 
$lg.lightGallery(); 
$lg.data('lightGallery').destroy(true);			
$lg.lightGallery();

Thanks, guys for the destroy function hint.

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

No branches or pull requests

3 participants