Jump to content
Search Community

Scrolling to bottom and back to top makes animations smoother in Safari?

tobiasger test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I'm doing a Timeline that gets run by scrolling the page, updating the Timeline progress depending on scroll position. I noticed that some transitions in Safari were really choppy and tried to optimize it.

First off, changing opacity transitions from opacity: 1 or opacity: 0 to opacity: 0.999 and opacity: 0.001 seems to solve the jerkiness a lot. I read this on this forum and it seems to be a confirmed solution for optimizing in some browsers.

But one other thing that I noticed was that if I scroll through the whole site once and then back up, scrolling the site downwards again manually makes the animations run smoother. Almost like if Safari wants to see and execute the animations first before running them smoothly the next time.

So I added this ugly hack just to try it out:
 

$(window).on("load", function () {
    $("html, body").animate({ scrollTop: $(document).height() }, 10);
    setTimeout(function () {
        $("html, body").animate({ scrollTop: 0 }, 10);
    }, 10);
})


And doing this before I begin to scroll manually, the animations are noticeably smoother than if I were to scroll it from the top without scrolling to the bottom first. I don't know why I'm telling you this, but have this been noticed and confirmed to work before? Does it have to do with caching of the values or what?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...