Profile picture of Michael GroßklausMichael Großklaus

TIL: change event for media queries

There is a change event that can be used to listen to media query changes:

const mediaQuery = window.matchMedia("…");

mediaQuery.addEventListener("change", (e) => {

});