-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Load Gallery with AJAX #229
Comments
I think I'm experimenting a similiar issue. I initially load n images and issue an AJAX request on scroll to get more images. The five initial images work fine, but the new ones don't get the functionality (clicking on them just takes me to the url of the image). I'm calling $('.container).lightGallery({ ... }); again on AJAX success: function(res) { ... }. I'm also using the Wookmark plugin |
I managed to solve this by properly destroying the gallery and loading it again on AJAX success: function(res) { ... } Proper way to destroy the gallery: // destroy |
We want to update the items while the gallery is opened. Say we have a load more or navigated to the end of current items. Currently Could you tell me if you have a better work around of this scenario? |
Hi @reillo , |
@sachinchoolur Any plan of this future method? |
When i get images with ajax its give me error " TypeError: a is undefined " But if i add hard code link of images like this in " dynamicEl:[{"src": "mlphotos/imgs/564d982d2bed1_kosta.jpg","thumb": "mlphotos/imgs/564d982d2bed1_kosta.jpg",}] " Then its working fine,
-> But i want to load images with ajax below are my code
Below are my code help me what is the issue here??
$.ajax({
url: "ajax_viewlarge_click" ,
type: 'POST',
dataType:"json",
success: function(data) {
//-------------------------
dynamicphoto = '';
for (var i = 0; i < data.length; i++) {
dynamicphoto += '{"src": "'+data[i]+'","thumb": "'+data[i]+'",},';
}
$.getScript($('#baseUrl').val()+"/application/layouts/scripts/themes/trailblazer/js/lg/lightgallery.min.js", function( datas, textStatus, jqxhr ) {
var pictures = "["+dynamicphoto+"]";
$(this).lightGallery({
dynamic: true,
html:true,
dynamicEl:pictures
});
});
},
error: function(e) {
console.log("Server failure! Is the server turned off?");
}
});
The text was updated successfully, but these errors were encountered: