(202) 750-1910
  • Facebook
  • X
  • Instagram
  • TikTok
  • Yelp
  • Google
  • Pinterest
  • WhatsApp
  • Threads
  • Facebook
  • X
  • Instagram
  • TikTok
  • Yelp
  • Google
  • Pinterest
  • WhatsApp
  • Threads
0 Items
Ask the Egghead, Inc.
  • Home
  • About
    • Reviews
    • Awards
    • Careers
    • Partners
    • Systems Status
  • Services
    • Website Design
    • Managed Hosting
    • Accessibility Compliance
    • Content Builder
    • Multi-Language Websites
    • SEO
    • Social Media
    • Premier Property Promotion
    • Reputation & Review Management Services
    • Low Code/No Code Solutions for MVP Development
    • Citation Builder
    • Pricing
    • Get A Quote
  • Portfolio
  • Website Audit
  • Blog
  • Invest Local
  • Contact
Select Page

How to Restart an Animation Every Time You Scroll Past an Element with Divi & GSAP

When it comes to animating elements on your page, you’ll most likely want to activate an element’s animation once it enters the viewport. With Divi’s built-in animation settings, as soon as that element has come into view, and has been animated, it will remain static until you reload the entire page. In some cases, you might look for a more consistent approach, where your animation restarts with each viewport entry. Doing this will help you streamline the experience visitors have on your website. In this tutorial, we’ll show you exactly how to do that using Divi, GSAP and ScrollTrigger for GSAP. Once you get the approach, you’ll be able to apply it to any element on your page. You’ll be able to download the JSON file for free as well!

Let’s get to it.

Preview

Before we dive into the tutorial, let’s take a quick look at the outcome across different screen sizes.

Desktop

restart animation

Mobile

restart animation

Download The Layout for FREE

To lay your hands on the free layout, you will first need to download it using the button below. To gain access to the download you will need to subscribe to our Divi Daily email list by using the form below. As a new subscriber, you will receive even more Divi goodness and a free Divi Layout pack every Monday! If you’re already on the list, simply enter your email address below and click download. You will not be “resubscribed” or receive extra emails.

Download the Files
.et_bloom .et_bloom_optin_1 .et_bloom_form_content { background-color: #4843d2 !important; } .et_bloom .et_bloom_optin_1 .et_bloom_form_container .et_bloom_form_header { background-color: #ffffff !important; } .et_bloom .et_bloom_optin_1 .carrot_edge .et_bloom_form_content:before { border-top-color: #ffffff !important; } .et_bloom .et_bloom_optin_1 .carrot_edge.et_bloom_form_right .et_bloom_form_content:before, .et_bloom .et_bloom_optin_1 .carrot_edge.et_bloom_form_left .et_bloom_form_content:before { border-top-color: transparent !important; border-left-color: #ffffff !important; }
@media only screen and ( max-width: 767px ) {.et_bloom .et_bloom_optin_1 .carrot_edge.et_bloom_form_right .et_bloom_form_content:before { border-top-color: #ffffff !important; border-left-color: transparent !important; }.et_bloom .et_bloom_optin_1 .carrot_edge.et_bloom_form_left .et_bloom_form_content:after { border-bottom-color: #ffffff !important; border-left-color: transparent !important; }
}.et_bloom .et_bloom_optin_1 .et_bloom_form_content button { background-color: #f92c8b !important; } .et_bloom .et_bloom_optin_1 .et_bloom_form_content .et_bloom_fields i { color: #f92c8b !important; } .et_bloom .et_bloom_optin_1 .et_bloom_form_content .et_bloom_custom_field_radio i:before { background: #f92c8b !important; } .et_bloom .et_bloom_optin_1 .et_bloom_border_solid { border-color: #f7f9fb !important } .et_bloom .et_bloom_optin_1 .et_bloom_form_content button { background-color: #f92c8b !important; } .et_bloom .et_bloom_optin_1 .et_bloom_form_container h2, .et_bloom .et_bloom_optin_1 .et_bloom_form_container h2 span, .et_bloom .et_bloom_optin_1 .et_bloom_form_container h2 strong { font-family: “Open Sans”, Helvetica, Arial, Lucida, sans-serif; }.et_bloom .et_bloom_optin_1 .et_bloom_form_container p, .et_bloom .et_bloom_optin_1 .et_bloom_form_container p span, .et_bloom .et_bloom_optin_1 .et_bloom_form_container p strong, .et_bloom .et_bloom_optin_1 .et_bloom_form_container form input, .et_bloom .et_bloom_optin_1 .et_bloom_form_container form button span { font-family: “Open Sans”, Helvetica, Arial, Lucida, sans-serif; } p.et_bloom_popup_input { padding-bottom: 0 !important;}

Download For Free

Download For Free

Join the Divi Newsletter and we will email you a copy of the ultimate Divi Landing Page Layout Pack, plus tons of other amazing and free Divi resources, tips and tricks. Follow along and you will be a Divi master in no time. If you are already subscribed simply type in your email address below and click download to access the layout pack.

You have successfully subscribed. Please check your email address to confirm your subscription and get access to free weekly Divi layout packs!

 

1. Create Section Design

Add Placeholder Section

Before we start creating the design, we’ll add two placeholder sections to the page we’re working on. That way, we can see the scroll experience once the design is finished. Alternatively, you can use the design inside a page you have already set up. Add a new regular section.

restart animation

Sizing

Modify the section’s height as follows:

  • Height: 100vh

restart animation

Clone Placeholder Section

Then, clone the section once.

restart animation

Add New Section Between Placeholder Sections

To create the design you were able to see in the preview of this post, we’ll add a new regular section in between placeholder sections.

restart animation

restart animation

Add Row #1

Column Structure

Continue by adding a new row to the section using the following column structure:

restart animation

Sizing

Without adding modules yet, open the row settings, go to the design tab and change the sizing settings as follows:

  • Use Custom Gutter Width: Yes
  • Gutter width: 2
  • Width: 90%
  • Max Width: 2080px

restart animation

Add Text Module #1 to Column

Add Content

Then, add a first Text Module to the column and include some content of your choice.

restart animation

Text Settings

Move on to the module’s design tab and change the text settings accordingly:

  • Text Font: Montserrat
  • Text Font Weight: Heavy
  • Text Font Style: Uppercase
  • Text Color: #f9f9f9
  • Text Size:
    • Desktop: 150px
    • Tablet & Phone: 11vw
  • Text Line Height: 1.1em
  • Text Alignment: Center

restart animation

Add Text Module #2 to Column

Add H2 Content

Add another Text Module below the previous one and include some H2 content.

restart animation

H2 Text Settings

Style the H2 text as follows:

  • Heading 2 Font: Montserrat
  • Heading 2 Text Alignment: Center
  • Heading 2 Text Size:
    • Desktop: 80px
    • Tablet & Phone: 10vw

restart animation

Sizing

Add a width of 100% too.

  • Width: 100%

restart animation

Position

And reposition the entire module in the advanced tab.

  • Position: Absolute
  • Location: Center

restart animation

Add Row #2

Column Structure

Add another row below the previous one, using the following column structure:

restart animation

Sizing

Without adding modules yet, open the row settings and adjust the sizing settings as follows:

  • Use Custom Gutter Width: Yes
  • Gutter Width: 2
  • Width: 90%
  • Max Width: 2080px

restart animation

Column 1 Settings

Then, open the column 1 settings.

restart animation

Background Image

Upload a background image of your choice.

  • Background Image Size: Cover
  • Background Image Position: Center

restart animation

Spacing

Modify the column’s spacing settings next.

  • Top Padding: 100px
  • Bottom Padding:
    • Desktop: 400px
    • Tablet & Phone: 200px
  • Left Padding: 5.5%
  • Right Padding: 5.5%

restart animation

Add Text Module #1 to Column 1

Add H4 Content

Then, add a Text Module to column 1 with some H4 content.

restart animation

H4 Text Settings

Style the H4 text accordingly:

  • Heading 4 Font: Lato
  • Heading 4 Font Weight: Heavy
  • Heading 4 Font Style: Uppercase
  • Heading 4 Text Size: 13px
  • Heading 4 Letter Spacing: 2px

restart animation

Add Text Module #2 to Column 1

Add H3 Content

Add another Text Module below the previous one, using some H3 content.

restart animation

H3 Text Settings

Change the H3 text settings accordingly:

  • Heading 3 Font: Montserrat
  • Heading 3 Text Size: 36px
  • Heading 3 Letter Spacing: 1px
  • Heading 3 Line Height: 1.2em

restart animation

Add Text Module #3 to Column 1

Add Description Content

Add the last Text Module containing some description content of your choice.

restart animation

Text Settings

Change the module’s text settings as follows:

  • Text Font: Lato
  • Text Color: #4c4c4c
  • Text Letter Spacing: 0.5px
  • Text Line Height: 2em

restart animation

Add Button Module to Column 1

Add Copy

The last module we need in this column is a Button Module. Add some copy of your choice.

restart animation

Button Settings

Style the button in the design tab.

  • Use Custom Styles For Button: Yes
  • Button Text Size: 14px
  • Button Text Color: #ffffff
  • Button Background Color: #000000
  • Button Border Width: 0px

restart animation

  • Button Font: Lato
  • Button Font Weight: Bold
  • Button Font Style: Uppercase

restart animation

Reuse Column 1

Delete Column 2 & 3

Once you’ve completed column 1, and all modules inside it, you can delete the two remaining columns of the row.

restart animation

Clone Column 1 Twice

And reuse column 1 by cloning it twice.

restart animation

Change Duplicate Column Background Images

Make sure you change the background image of each duplicate column.

restart animation

Change Content in Duplicate Columns

Along with the module content.

restart animation

Add Transform Translate to Column 2 Settings

Then, open the column 2 settings and go to the design tab. Once there, add some transform translate values across different screen sizes to complete the design.

restart animation

  • Left:
    • Desktop: 50px
    • Tablet & Phone: 0px

restart animation

2. Apply Restart Animation Technique to Design

Add CSS Class to Row #2

Now that our design is in place, we can focus on the restart animation technique. We’re going to target multiple modules at once for this. First, open the second row’s settings and apply the following CSS class:

  • CSS Class: trigger-animation-row

restart animation

Add Code Module to Row #1

The CSS class we’ve added in the previous step of this tutorial will help us target all modules inside this row at once. To create the restart animation, we’re using some JQuery code, the GSAP JavaScript library and the ScrollTrigger library for GSAP. To add this code, we’ll insert a new Code Module below the second Text Module in row #1.

restart animation

Add GSAP & ScrollTrigger Libraries

Make sure you add the GSAP and ScrollTrigger libraries inside new script tags.

  • https://cdnjs.cloudflare.com/ajax/libs/gsap/3.5.1/gsap.min.js
  • https://cdnjs.cloudflare.com/ajax/libs/gsap/3.5.1/ScrollTrigger.min.js

restart animation

Add New Script Tags

Then, add new script tags below the library script tags.

restart animation

Add GSAP + ScrollTrigger Function

Inside the new script tags, we’ll copy paste the following lines of JQuery code:

jQuery(document).ready(function($){

var $module = $('.trigger-animation-row .et_pb_module');

$module.each(function(){
var $thisModule = $(this);

gsap.from($thisModule[0], {
scrollTrigger: {
trigger: this,
start: "bottom bottom",
end: "center top",
scrub: false,
repeat: -1,
toggleActions:'restart none none reset'
},
opacity: 0,
x: -100,
scale: 1.1,
duration: 2,
ease: "back"
});
});
});

This code will target all row modules at once and will restart the animation as soon as a visitor enters the viewport again. The animation, in this case, is pretty straightforward and minimal. However, with GSAP and ScrollTrigger, you can create any kind of animation you want, so it’s definitely worth looking into!

restart animation

Preview

Now that we’ve gone through all the steps, let’s take a final look at the outcome across different screen sizes.

Desktop

restart animation

Mobile

restart animation

Final Thoughts

In this post, we’ve shown you how to restart an animation as soon as the element enters the viewport. This approach helps you create a consistent experience, no matter how your visitors scroll. You were able to download the JSON file for free as well! If you have any questions or suggestions, feel free to leave a comment in the comment section below.

If you’re eager to learn more about Divi and get more Divi freebies, make sure you subscribe to our email newsletter and YouTube channel so you’ll always be one of the first people to know and get benefits from this free content.

The post How to Restart an Animation Every Time You Scroll Past an Element with Divi & GSAP appeared first on Elegant Themes Blog.

Recent Posts

  • Busting the Biggest WordPress Myths

    Busting the Biggest WordPress Myths

  • You’re Not Too Small for a Great Website

    You’re Not Too Small for a Great Website

  • Top Web Design Trends to Watch in 2025

    Top Web Design Trends to Watch in 2025

  • Lock Down Your Site: WordPress Security Made Easy

    Lock Down Your Site: WordPress Security Made Easy

  • Is It Time to Redesign Your Website?

    Is It Time to Redesign Your Website?

  • Don’t Ignore These Website Pages

    Don’t Ignore These Website Pages

  • AI Tools in Web Design: Hype vs. Real Help

    AI Tools in Web Design: Hype vs. Real Help

  • How to Make Your Website Feel Brand New Again

    How to Make Your Website Feel Brand New Again

  • No Leads? Here’s Why (And How to Fix It)

    No Leads? Here’s Why (And How to Fix It)

  • 7 Website Mistakes That Hurt Your Business

    7 Website Mistakes That Hurt Your Business

Awards

  • Clutch Top Web Design Company Medical Websites 2024

    Clutch Top Web Design Company Medical Websites 2024

  • Clutch Top Web Design Company Government Websites 2024

    Clutch Top Web Design Company Government Websites 2024

  • UpCity National Excellence Winner 2024

    UpCity National Excellence Winner 2024

  • UpCity National Excellence Winner 2023

    UpCity National Excellence Winner 2023

  • UpCity National Excellence Winner 2022

    UpCity National Excellence Winner 2022

  • UpCity Local Excellence Washington DC 2021

    UpCity Local Excellence Washington DC 2021

  • UpCity Top Designer 2021

    UpCity Top Designer 2021

  • DesignRush Accredited Agency 2021

    DesignRush Accredited Agency 2021

  • Clutch Top Company Washington DC 2021

    Clutch Top Company Washington DC 2021

  • Digital.com Best SEO Firms Washington DC 2021

    Digital.com Best SEO Firms Washington DC 2021

Ask-the-Egghead-logo

Capability Statement

View/Download

Ask the Egghead

200 Massachusetts Ave NW
8th Floor Suite 133
Washington, DC 20001
(202) 750-1910

Ask the Egghead

399 Boylston Street
Suite 685
Boston, MA 02116
(617) 221-8300

Quick Links

  • Website Design
  • Social Media
  • SEO
  • Managed Hosting
  • Privacy Policy
  • Investors
  • Facebook
  • X
  • Instagram
Designed by The Egghead © 2015-2025 Ask the Egghead, Inc.