Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

Change the Gallery Throttle Time

When a gallery is preloaded, the script that repaints the DOM and repositions elements is throttled. It is throttled in order to minimize performance issues within the browser itself, especially browsers that do not have fast JavaScript parsing engines.

By default, it is set to 500ms. This can sometimes cause a “lag” in the waterfall of the elements, so if you want to reduce the throttle time to something like 200ms, drop the following code into your active theme’s functions.php file. You can change and adjust 200 as you see fit.

add_filter( 'envira_gallery_enviratope_throttle', 'tgm_envira_set_envira_throttle', 10, 2 );
function tgm_envira_set_envira_throttle( $time, $data ) {
    
    // We are going to set the throttle to 200 instead of 500. Change it to whatever you see fit.
    return 200;
    
}