Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

How to Zoom Thumbnail Images on Hover

Would you like use CSS to zoom an image on hover? With a little CSS you can easily achieve this! This tutorial will show you how you can use CSS to zoom your gallery image on hover.

This tutorial is a little more technical then the other docs and will require a basic level of CSS.

Your first step is to create a new gallery or edit an existing one. You can follow along with our documentation for creating your first gallery

Next, on the Configuration tab, select any column count for your Number of Gallery Columns.

First set up the number of gallery columns so that you can style your gallery images

The next step you’ll need to install and activate Envira’s CSS Addon. Navigate to the Addons section and click Install then Activate on the CSS Addon.

Install and activate the CSS addon

Below is the CSS we’ve used in our demo.

You’ll need to change this ID number to match your gallery ID number. You can find this by looking in the sidebar of your gallery edit screen.

For more information on how to find your gallery ID number you can read this article.

You can also just add this CSS to the WordPress Customizer to make this change for all of your Envira Galleries!

To find out more about the WordPress Customizer, please review our article on How to add custom CSS to the WordPress Customizer.

If you’re using the CSS Addon to only change 1 gallery, add your CSS to the Misc tab inside the Custom Gallery CSS box.

Add your CSS to the Misc tab in the Custom Gallery CSS box to zoom an image on hover
Once you’ve added your CSS just click Publish or Update to save the changes to the gallery.

#envira-gallery-438745 .envira-gallery-item img { 
transition: all .2s ease-in-out; 
} 
#envira-gallery-438745 .envira-gallery-item:hover img { 
transform: scale(1.1); 
} 
#envira-gallery-438745 .envira-gallery-item, #envira-gallery-438745 .envira-gallery-item .envira-gallery-item-inner { 
overflow: hidden; 
}

You can also adjust the amount of zoom by editing the transform: scale(1.1) value, a higher number will result in a larger zoom level.

Be sure to update the -438745 with your own gallery ID number

If you’re going to want this change for all galleries, just remove the gallery ID number from the CSS and add your CSS to the Appearance » Customize » Additional CSS and click Publish to save the changes.

Check out the demo


Q: Can I do the same for albums too?

A: Absolutely! You’d use exactly the same CSS but just be sure the ID matches the album. If you added your CSS to the WordPress Customizer then it would automatically make this change for all Envira gallery and album images.


Q: Do I have to use CSS for this?

A: Not at all! Using Envira’s Gallery Themes Addon, if you select the Polaroid theme, there is automatic styling added when you zoom on the image.

You can see a demo of the Polaroid theme to see it in action!