Pra*_*mar 0 javascript jquery lightgallery
我从Firefox收到此错误:
TypeError: $(...).lightGallery(...).destroy is not a function
Run Code Online (Sandbox Code Playgroud)
我正在使用以下插件播放视频并显示图片库 https://github.com/sachinchoolur/lightGallery。
我想重新初始化lightGallery,因为我正在使用ajax在容器中动态添加元素。在以前版本的lightGallery上运行正常,但在当前版本上不运行。
我正在使用以下代码。
// destroy previous gallery
$("#lightGallery2").lightGallery({
selector : '.image_gallery',
videojs: true,
download: false
}).destroy();
// re-initialize
$("#lightGallery2").lightGallery({
selector: '.image_gallery',
videojs: true,
download: false
});
Run Code Online (Sandbox Code Playgroud)
请提出建议。
谢谢
小智 5
以下代码对我有用:
$lg.on('onBeforeClose.lg',function(event, index, fromTouch, fromThumb){
try{$lg.data('lightGallery').destroy(true);}catch(ex){};
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4396 次 |
| 最近记录: |