r/javascript • • Aug 21 '18

Effectively supported in all browsers, JavaScript has its own form of media queries just like CSS.

https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia
465 Upvotes

114 comments sorted by

View all comments

10

u/DOG-ZILLA Aug 21 '18

I had been using a utility in Modernizr for years for this kinda thing before discovering match media literally the other day.

Felt great to remove another small dependency from the codebase.

14

u/dombrant Aug 22 '18

Few things match the high of removing unnecessary code for me.