Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

How to enable distraction-free mode

Would you like to turn on the Distraction Free viewing when viewing lightbox images on Envira?

Distraction-free viewing hides the icons after 60 seconds, so you can fully view the image in the lightbox.

With Envira Gallery, you can achieve this using simple code snippets. This guide will show you how!

Heads up!

This article contains PHP, CSS, and/or JavaScript to customize our plugin. We offer this code as a courtesy but don’t provide support for additional code customizations or 3rd party development.

To enable the distraction-free mode, just add the following code to your site.

If you need help adding custom code to your site, please check out our guide on adding custom PHP or JavaScript to your site.

/* Envira - Enable Distraction Free Mode for the Lightbox
 * 
 * @link https://enviragallery.com/docs/how-to-enable-the-envira-distraction-free-mode/
 */

add_filter( 'envira_gallery_get_config', 'my_envira_gallery_get_config', 10, 2 );

function my_envira_gallery_get_config( $data_config, $key ) {
    if ( $key === 'idle_time' ) {
        $data_config['idle_time'] = 60; 

// false would completely turn off the option and is set to false by default.Change this to 60 to have the idle time kick in after 60 seconds
    }
    return $data_config;
}

Once the code has been added, open the image in lightbox mode and wait for 30 seconds. The icons and other elements appearing in the lightbox mode disappear automatically.

And that’s it! You’ve now disabled the distraction-free mode on the Envira Gallery lightbox.

Enable Distraction Free View in Lightbox

Would you like to try some more fun things with Envira Lightbox? Why not check out our article on How to Use the Lightbox Transition Effects.


FAQ

A: Currently no, this will only apply to galleries for now. We’ll update the doc when this is available for albums so keep checking back!


A: No, this will apply to all galleries (and albums when albums become available).