Jump to content
Search Community

Width and height check in ScrollTrigger.matchMedia()

Patrick Rijkee
Moderator Tag

Go to solution Solved by tailbreezy,

Recommended Posts

Patrick Rijkee
Posted

Hello everyone,

 

I have an animation that needs to display only above 992px width and 700px height.

however it seems i cant add more than one condition to matchMedia.

 

What is the (proper) way to do this?

 

(I hope you dont mind i used your matchMedia demo as a starting point for my codepen)

 

Thanks,

Patrick Rijkee

See the Pen MWbBLYW by parpar78 (@parpar78) on CodePen.

  • Solution
Posted

Hello,

 

It uses the css @media syntax:

 

	"(min-width: 800px) and (min-height: 800px)": function() {}

 

  • Like 4
Patrick Rijkee
Posted

This is strange, in my sass i have to use comma.

because "and" seems to split the media query to be 2 separate queries. but perhaps this is Sass specific.

 

thanks for the help. this seems to work in GSAP.

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