Skip to main content

gsap.matchMediaRefresh()

Immediately reverts all active/matching MatchMedia objects and then runs any that currently match. This can be particularly useful when you need to accommodate a UI checkbox that toggles something like "reduce motion":

Demo

loading...

Note that it does not destroy any gsap.matchMedia() instances. It simply reverts any currently matching ones, and then re-runs any that match. Think of it almost like what would happen if you completely resized the window in such a way that all currently matching ones no longer matched, and then the window got resized back to the original size so that they match again.

Contents