Jump to content
GreenSock

juan-alvarz

Different animations according to mediaqueries

Moderator Tag
Go to solution Solved by Carl,

Recommended Posts

Hello everyone of GSAP.

I have a project where I have to incorporate animations according to screen size (Desktop, Tablet & Mobile, for each device), so, we have 3 different animations, the question is, how can I make GSAP run one animation file or another depending on the size of the screen? the animations between these 3 services are really very different.

I tried with an if according to the innerWidth, however I think that before that, I must execute some kill and some enable in case the browser resize is done, because of the responsive

Thanks a lot for your helping

Link to comment
Share on other sites

  • Solution

Hi. It sounds like you are looking for gsap.matchMedia() the docs have an excellent video and a bunch of examples to get you on your way.

  • Like 4
Link to comment
Share on other sites

thank you very much carl, that worked perfectly!

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