Jump to content
Search Community

new matchMedia with scrollTrigger direction throwing an error on resize

GilesP test
Moderator Tag

Recommended Posts

Hi, I'm trying out the new matchMedia feature.

 

I have a scroll triggered animation that reveals text sections as you scroll up and down. It checks for the direction of the scroll  and inverts which element fades in or out.

 

I am trying to only have this run on large screen sizes, which works as expected, but if you resize the window below the matched media query, it throws the error "Uncaught TypeError: Cannot read properties of null (reading 'direction')" and the tween does not get reverted. 

 

Should I be using some kind of callback or cleanup function to revert that part of the timeline

 

Thanks!

 

See the Pen YzLzyqZ by gpartington (@gpartington) 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...