0

我使用了很棒的 LightGallery js 模块:https ://github.com/sachinchoolur/lightGallery https://sachinchoolur.github.io/lightGallery/

如何以全屏模式启动 LightGallery?单击工具栏中的图标可以激活全屏模式,但是如何在全屏模式下启动幻灯片?

4

1 回答 1

4

我在官方页面(https://sachinchoolur.github.io/lightGallery/)的评论部分找到了插件作者(sachi77n)发布的以下答案。

我会在这里为任何试图实现此功能的人发布它。


您可以在 lightGallery 的onAfterOpen.lg事件上触发全屏功能。

$(document).ready(function() {
    var $lg = $('#lightgallery');
    $lg.lightGallery();
    $lg.on('onAfterOpen.lg', function(){
        $lg.data('lightGallery').modules.fullscreen.requestFullscreen();
    });
});

演示:http ://codepen.io/anon/pen/xgEBZq 。

于 2017-01-26T14:34:44.067 回答