question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Slow Performance on Smooth Scroll - Animation Stuttering

See original GitHub issue

Hello 👋

Describe the bug Even though I’ve incorporated the data-scroll-section, I’ve noticed when I enable smooth scroll the scroll behavior becomes very slow and choppy and my CSS animation stutter heavily. It becomes a lot more noticeable on elements that have different data-scroll-speed for the parallax effect (in my case is a bunch of images in a grid).

To Reproduce I can’t share my code here but I noticed the same frame drops on the locomotive.ca homepage. But at the same time when I visit this codepen example, everything is buttery smooth! The reason I chose the locomotive.ca website is that my homepage shares a lot of similarities (like using Swiper Js,GSAP, etc). Regardless I’ve forked the codepen example mentioned above surprisingly it’s buttery smooth literally everywhere except the section I added. Here the link to the forked version: https://codepen.io/itsprorez/pen/xxOgRoO . I’ve noticed the choppiness mainly when the scroll travels a short distance and when it’s easing at the end.

Expected behavior I really want to achieve the same performance as this codepen example but I have no idea what I’m doing wrong!

Screenshots

Desktop (please complete the following information):

  • OS: Windows
  • Browser Chrome
  • Version 86.0.4240.111 (Official Build) (64-bit)

Smartphone (please complete the following information): Everything works fine on smartphones. I’ve noticed the problem only on desktop browsers.

Thank you 👊

UPDATE: I’ve incorporated the CSS will-change property ( https://developer.mozilla.org/en-US/docs/Web/CSS/will-change ) on those elements that get animated on the scroll and that has helped a lot with the scroll performance. But there are still some frame drops every once in a while.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:5
  • Comments:6

github_iconTop GitHub Comments

2reactions
BlazeIsClonecommented, Jun 13, 2021

Hey guys so I’ve ran into the same problem, everything worked fine except when the scrolling came to an end the text will start loosing FPS and becomes laggy (like a shivering effect). I’ve tried many different things although one thing fixed it for me, so check this out if you are facing something similar to what I have experienced.

will-change: transform, opacity;

Don’t apply will-change to too many elements (that’s the first things said in the docs)

MDN Web Docs - will-change

1reaction
ehsan-shvcommented, Nov 10, 2020

do you find better way to fix this problem?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Downsides of Smooth Scrolling - CSS-Tricks
Perhaps the largest downside of smooth scrolling is the potential to mismanage focus. Scrolling to an element in JavaScript is fine, so long...
Read more >
Animated Scrolling Performance Stuttering - MSDN - Microsoft
I am animating the scrolling via a DoubleAnimation. I have some Deacceleration provided so that the scrolling slows down during the end of ......
Read more >
Smooth scrolling performance on slow device - Stack Overflow
Now that animation is not very fluid, it stutters because of the pi3's low performance. I'd like to know if there is any...
Read more >
How to get rid of scrolling lag / stutter on Android! - Reddit
TLDR: Stuttering is caused by the CPU constantly changing frequencies multiple times a second even, when it drops down to those "lower frequencies"...
Read more >
ScrollTrigger animation performance on 'low-end' devices
One uses ScrollMagic + GSAP and one uses ScrollTrigger + GSAP. Both work perfectly smooth on my workstation with somewhat up-to-date hardware ( ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found