How to Animate a GIF on Hover in Divi (Without Pulling Your Hair Out)

Ever tried to animate a GIF on hover in Divi and felt like Divi had trust issues with your mouse? You’re not alone. But here’s the good news—this little trick will make your GIFs come alive like they’ve had too much coffee, and you don’t even need a plugin. Yep, not even one line of JavaScript. Let’s do this.

What You’ll Learn

We’re going to show you how to load a static image first and switch it to an animated GIF when the user hovers. Why? Because if you drop a GIF directly into Divi, it starts playing right away and never stops. That’s great for cat memes, but terrible for UX.

Try it 👇

Before You Start

  • You’ll need a static image (JPG or PNG) that acts as your preview thumbnail.
  • An animated GIF version of that image.
  • A Divi website (obviously).
  • About 3 minutes and one cup of coffee.

Step 1: Add an Image Module in Divi

In the Divi Builder, drop in a regular Image Module where you want your hover animation magic to happen. Upload your static image as the main image.

PRO TIP: Make sure the static image is the same dimensions as your GIF. Otherwise, you’ll get a glitchy jump that’ll make your designer soul cry.

Step 2: Add a CSS Class

Still in the Image Module, go to the Advanced > CSS ID & Classes tab and give it a class. Let’s call it de-gif-hover. You can change this later if you’re feeling rebellious.

Step 3: Add Custom CSS

Now jump into Divi > Theme Options > Custom CSS and paste in the following:

.de-gif-hover {
  content: url('https://yoursite.com/path-to-static-image.png');
  transition: all 0.3s ease-in-out;
}

.de-gif-hover:hover {
  content: url('https://yoursite.com/path-to-animated-gif.gif');
}

Replace the URLs with the actual links to your static image and your animated GIF. You can upload both to the Media Library and copy the URLs from there.

PRO TIP: You can use a pseudo-element with :before or wrap the image with a <div> and use background-image if you want to get fancier with layering text or hover effects. But if this is your first time, stick to this basic approach.

Ideas for Where to Use This

  • Team pages: Hover to animate staff doing something quirky.
  • Product listings: Show product in action when hovered.
  • Portfolios: Static preview, animated case study when hovered.
  • Testimonials: Add subtle movement to boost authenticity.

Wrapping Up

This method keeps your page load light and your animations subtle but effective. Great UX without slowing down the site or overwhelming your visitors with dancing pixels on page load. If you’re already using Divi BodyCommerce or Divi Machine, imagine layering this technique over your product galleries or custom loops for some extra flair.

And if you want to keep pulling off cool tricks like this without writing a single plugin, grab our All Access Pass and unlock every plugin, layout, and secret weapon in our vault. Because let’s be honest, your site deserves more than a static shrug.

Tell Us What You Think!

0 Comments

Submit a Comment

Explore more from Divi Engine

Divi Form Builder

Divi Form Builder

From simple contact forms to complex frontend post or product creation, Divi Form Builder has you covered.

Divi Form Builder
Find out more
Divi Machine

Divi Machine

Build complex websites that displays dynamic fields you can filter, search and so much more with the Divi Builder.

Divi Machine
Find out more
Divi BodyCommerce

Divi BodyCommerce

A versatile toolkit for developers using Divi and WooCommerce together, designed to boost your e-commerce site and achieve greater conversion rates.

Divi BodyCommerce
Find out more
Divi Loop Extender

Divi Loop Extender

Unlock the Full Power of Divi 5 Loop Builder Add advanced sorting, filtering, and relationship logic right inside the Visual Builder.

Divi Loop Extender
Find out more
Divi Membership

Divi Membership

Monetize your Divi websites by transforming them into membership sites with seamless subscription management, user-friendly interfaces, and customizable membership tiers.

Divi Membership
Find out more
Divi Machine Accounts

Divi Machine Accounts

Build an account area for your customers to edit their details, access wishlist, submitted posts and more. *Note: Requires Divi Machine installed and active

Divi Machine Accounts
Find out more
Divi Ajax Filter

Divi Ajax Filter

Filter WooCommerce, Posts & Custom Posts without reloading the page.

Divi Ajax Filter
Find out more
Divi Mobile

Divi Mobile

Divi Mobile helps you create beautiful looking mobile menus without having to code.

Divi Mobile
Find out more
Divi Nitro

Divi Nitro

Give your Divi website that extra boost of speed with our Divi Nitro plugin to enhance your customer's experience.

Divi Nitro
Find out more
Divi Protect

Divi Protect

Password protect the content of your Divi website with our Divi Protect plugin. Keep unwanted eyes out!

Divi Protect
Find out more
Divi Mega Menu

Divi Mega Menu

Improve the user experience of your Divi website with our Divi Mega Menu plugin by creating dynamic menus using the Divi Builder.

Divi Mega Menu
Find out more