Created
February 23, 2022 10:58
-
-
Save anova/5ffc64f2bb3fc9d79bb3c1f960a598f1 to your computer and use it in GitHub Desktop.
Trigger events by breakpoint change.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const breakpoint_lg = window.matchMedia('(min-width: 992px)'); | |
breakpoint_lg.addEventListener('change', () => { | |
if(breakpoint_lg.matches) { | |
console.log('lg'); | |
return; | |
} | |
console.log('not lg'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment