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.
Adding the Code Snippet
To enable the distraction-free mode, just add the following code 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.