[Tips & Scripts] On-Scroll Animations


Userlevel 7
  • Former Unbouncer
  • 126 replies

This tutorial guides you through creating On-scroll Animations on your Unbounce landing pages. By using On-scroll Animations, you can specify when and where your content is revealed as a visitor scrolls down your landing page.

If used correctly, On-scroll Animations can help you create landing pages that are delightful and engaging.

👁️ See this on a live Unbounce page here.


How to Install in Unbounce

Click Here for Instructions

🚨
This is not an official Unbounce feature. This functionality is based entirely on third party code, and has only been tested in limited applications. Since this isn’t a supported Unbounce feature, our support team will be unable to assist if things go awry. So if you are not comfortable with HTML, Javascript and CSS, please consider consulting an experienced developer.


Scripts Needed

https://gist.github.com/noahub/88d39d0fb5947efdb25e


Instructions

Step 1.
Copy the latest onscroll_animations.js script and paste it into the Javascripts section of your landing page.

Step 2.
Update the ‘#lp-pom-image-126’ with the ID of your page element.

If needed, you can also change the animation effect by replacing ‘bounceIn’ with any animate.css effect and the timeout duration (in ms) by changing the ‘1000’ value.

Step 3.
Add a new addAnimationData(); function call for every page element you wish to animate.

Step 4.
Paste the onscroll_animations.css CSS code in the Stylesheets section.

Step 5.
Save and publish your page.

Testing

Like anything else you implement on your page, you’re going to want to test this out thoroughly to see what effect (if any) it has on your conversion rates. We recommend running an A/B test and segmenting a small portion of traffic towards the page - just to be safe.

Conclusion

These animations may require some tweaking to get the timing just right. We’ve given you the ground work, but we would love to see how you implement this on your own pages. This is your chance to get creative and show the Unbounce community how you’re using this.


Can’t see the instructions? Log in or Join the Community to get access immediately. 🚀


Want to take your Unbounce landing pages + Convertables™ to the next level?
:spinbounce: Check out the Ultimate List of Unbounce Tips, Scripts & Hacks


107 replies

Userlevel 7

Hey @Joe_Hargrave1 and @reueleasy!

Sorry it’s taken awhile to address this request. If you’re looking to have the animations run only once, you can remove or comment out:

Give that a try and let me know if it does the trick!

Userlevel 7
Badge +4

Noah,  I owe you some poutine & beer.

Next time you’re in Montreal - give me a shout!

Thanks!

Userlevel 7

Basically, for every page element that is being animated you are going to have an addAnimationData(); function call. For example, if you have two images you want to animate, ‘#lp-pom-image-126’ and ‘#lp-pom-image-127’, you would have two lines that look something like this:

addAnimationData('#lp-pom-image-126','bounceIn','1000');addAnimationData('#lp-pom-image-127','bounceIn','1000');

To make things a bit easier, I’ve edited the post above to include a link to the .unbounce template used in the example. This way you can import the page into your own account and see firsthand how it’s all set up. 
Enjoy!

Sure thing! Check this article out for some insight on how to modify this for ‘on-load’: 
/topics/unbounce-tips-scripts-css-onload-animation

Hey @Noah, I commented the listed portions of code out and was able to immediately get the result I was looking for. Your fix worked perfectly, thanks so much for the code and even more for such a quick response!

Userlevel 7

Hey @lamp, it looks like Unbounce’s text scaling is being applied to the text after the animation runs. I’ll see if I can come up with a way around this, in the meantime you should be able to:

Badge

Hi, I ran into a little problem - the original code works well with “bounceIn” but other animations such as “flipInX” make the elements disappear as soon as the animation is finished. Do you know why that is?

Thank you for help!

Hi guys, doesn’t seem to work for me?

I’ve put in the javascript and stylesheet code, but no animation works on the live page.

Please see the attached images for the code, stylesheet code & stylesheet error (yet it doesn’t say what the error is!).

*all Javascript’s have the ‘before body end’ tag.

Any help would be greatly appreciated.

Thanks.

Style%20Sheet%20Error Style%20Sheet

Not sure how to do step 3.

Step 3. 
Add a new addAnimationData(); function call for every page element you wish to animate.

I’m sure a couple members of our Montreal Support team would gladly take Noah’s place on that one.

Userlevel 7
Badge +4

For some reason this isn’t working even after following these steps. Does it matter what we name the CSS and Javascript files? The CSS file says “invalid.”

@Noah this animation is pretty awesome! Thanks
I’m with @Joe_Hargrave1 , I’ve got the animation to work nicely but without refreshing the page when I scroll up the elements disappear and reanimation when I scroll down. I’m sure it’s a simple fix but any advice on how to sort it out?

Thanks a million!

Userlevel 7

Hey @reueleasy, I can confirm that the demo page is working fine on mobile. It sounds like something else might be going on here. Could you DM me with a link to your page?

Hey @Noah, love the script. It definitely adds that something extra to landing pages. I was able to get the original script to run without any trouble, but for whatever reason, the single run animation revision didn’t work for me. Aside from replacing the script shown in the screenshot, is there anything else that needs to be done?

Userlevel 7

Hey @aelisker! I’ve actually just made an update to the above workaround that I think should do the trick. Would you mind giving it a try and letting me know?

Userlevel 7

My pleasure, glad that did the trick 🙂

I was having the fits getting this script to work. The animate.js library has been updated. it is on version [3.5.2]()

Changing the 1 to a 2 made all the difference in the world.

Just a heads up if you are having issues.

Userlevel 7
Badge +4

What would be the best way to apply these effects to sticky bars? Has anyone tested it? Any known performance issues there?

Hey Noah, how you going? Having trouble implementing the single load on to my landing page. Removing one or both of the code in the red boxes interrupts the whole code & causes none of the objects to work.

Any help would be greatly appreciated.

Love these animations! This script is really helpful!

I’ve been running into the same issues on mobile and I think I have a solution…

For me, on mobile, I am only having the scaling issues with text that is already on the screen when the page loads. As it turns out, I think it’s just related to animate.css. Unbounce is using -webkit-transform: scale() to adjust text sizes on small screens. I think the animations are interfering with unbounce’s scaling via css transform.

To deal with this, I just wrapped each of my text objects in a box in the unbounce editor and applied the animation to the box instead. Then, I commented out the line that was applying animate first on touchscreen devices. Now it’s all working!

I also made some additional adjustments to the script so elements are animated when the are 1/3 of the screen height from the bottom of the screen…just personal preference.

Is it possible to run it in loop?

Soooo slick!

Brilliant stuff Noah!

I’m no programmer, but I do know how to follow directions.

Can’t wait to turn this on the world…

Thanks!

OK.

Any reason this would not work as a global script?

Seems like something I’d use at least once on every page. Or am I diving too deep?

Thanks!

Reply