How to start LightGallery in fullscreen mode?

3.1k views Asked by At

I use the great LightGallery js module: https://github.com/sachinchoolur/lightGallery https://sachinchoolur.github.io/lightGallery/

How can I start LightGallery in fullscreen mode? Fullscreen mode can be activated by clicking the icon in the toolbar, but how to start a slideshow in full-screen mode?

1

There are 1 answers

0
andreivictor On

I've found the following answer posted by plugin's author (sachi77n) in the comments section of the official page (https://sachinchoolur.github.io/lightGallery/).

I'll post it here for anyone that tries to achieve this functionality.


You can trigger the fullscreen function on lightGallery's onAfterOpen.lg event.

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

Demo: http://codepen.io/anon/pen/xgEBZq.