I am getting this error from firefox:
TypeError: $(...).lightGallery(...).destroy is not a function
I am using following plugin for play video and show image gallery https://github.com/sachinchoolur/lightGallery.
I want re-initialize lightGallery because I am using ajax to add element dynamically in container. It was working fine with previous version of lightGallery but it is not working with current version.
I am using following code.
// destroy previous gallery
$("#lightGallery2").lightGallery({
selector : '.image_gallery',
videojs: true,
download: false
}).destroy();
// re-initialize
$("#lightGallery2").lightGallery({
selector: '.image_gallery',
videojs: true,
download: false
});
Please suggest.
Thanks
The following code works for me: