Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

Changing the Transition Speed for Lightbox Images

Share This Post!

Would you like to speed up or slow down the transition speed for lightbox images? We will help you create a custom plugin that will help you complete this in a step by step process and we’re with you every step of the way! This custom function can be used for galleries as well as albums.

This tutorial is a bit more technical than our other docs, but we’ll walk you through the process step by step. In order to limit the caption length, we’ll need to create and upload a basic WordPress plugin.
  1. Creating the Plugin
  2. Activate the Plugin
  3. FAQs

Create the Plugin

To limit the amount of text that shows in the top of your lightbox view, just add the following code to a new file at wp-content/plugins/envira-lightbox-transition-speed.php.

<?php
/*
* Plugin Name: Envira Gallery - Control Lightbox Transition Speed
* Plugin URI: http://enviragallery.com
* Version: 1.0.0
* Author: Envira Gallery Team
* Author URI: http://enviragallery.com
* Description: Controls the speed of navigating, opening and closing Envira Albums and Galleries
*/
add_filter('envira_slideshow_gallery_speed', 'example_envira_slideshow_gallery_speed', 10, 2 ); function example_envira_slideshow_gallery_speed( $speed, $data ) { return 5000; }

add_filter('envira_slideshow_album_speed', 'example_envira_slideshow_album_speed', 10, 2 ); function example_envira_slideshow_album_speed( $speed, $data ) { return 5000; }

In the above code you can see return 5000;. This means when you open, close or navigate through your lightbox images, it will do this in 5 seconds (5000 milliseconds).

Not sure how to do that? Just follow these steps:

  1. Open a text file and make sure that it is a plain text document. You can use a plain text editor like Notepad or a code editor of your choice.
  2. Next, copy and paste the code above into the file and save the file as envira-lightbox-transition-speed.php. Remember to set the value of the transition you desire. (5000 = 5 seconds).
  3. Once you have saved the file you can easily upload this directly to your /plugins directory on your server using FTP or you can right-click on the text document and zip (or compress).
  4. Finally, log in to your WordPress dashboard and go to Plugins » Add New » Upload Plugin and upload the .zip file you just created in the previous step.

Activate the Plugin

Your next step is to activate the plugin you just uploaded. Simply navigate to the Plugins from within your WordPress dashboard and activate the Envira Gallery – Control Lightbox Transition Speed plugin.

you can easily control the transition speed from this plugin

And that’s it! You are now controlling the transition speed for all lightbox images. Want even more control over how your gallery displays? See our guide on how to limit your gallery to show only a certain number of images.

FAQs

Q: Can I change the speed per gallery?

A: Unfortunately no. Once the plugin is installed and activated it will be applied to every gallery that has the lightbox enabled.


Share This Post!