Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Marcello

Error running Scrolltrigger.matchmedia() and Storybook: _win is undefined

Recommended Posts

I have a Next.js/React project with typescript and Storybook: when using Scrolltrigger.matchmedia() function the component always give an error when running inside Storybook:

_win is undefined

matchMedia@http://localhost:6006/vendors~main.d3f7aa1f55228e485314.hot-update.js:1541:10

 

Removing matchmedia it all works as expected, but I need it in the project, this is very upsetting...

 

You can find the demo code here on github: https://github.com/marcello-palmitessa/gsap-scrolltrigger-issues-demo

 

Link to comment
Share on other sites

I bet you forgot to register the ScrollTrigger plugin 🙂

gsap.registerPlugin(ScrollTrigger);

 

Link to comment
Share on other sites

OMG you're right! I forgot that in Storybook the component are not wrapped by the _app component, where I put the registerplugin!!

 

Thank you!!!

 

  • Like 2
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.
×