Jump to content
Search Community

Correct usage of Scrolltrigger.Matchmedia & savestyles?

mattdown test
Moderator Tag

Recommended Posts

Hi all,

I've been trying to get my head around Matchmedia and Savestyles should be correctly used.

In this Codepen, the boxes are meant to fade in scroll if the viewport is wider than 1023px but then just appear as blocks without any animations for screen sizes smaller than that. If I start by viewing it as large size, the animations work as expected and then if I shrink the browser down they become non-animated for smaller screens, also as expected.

If I then stretch the browser to the larger size again, they appear full opacity until the trigger is reached. It's as if the initial state isn't being calculated by Scrolltrigger again?

What am I doing wrong here? Any help would be appreciated.

See the Pen RwGwBWO by mattdown2478910 (@mattdown2478910) on CodePen

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...