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

Show parent comments

6

u/backlashsid Aug 21 '18

Like what?

0

u/[deleted] Aug 22 '18

[deleted]

3

u/saitilkE Aug 22 '18

Ok, this is actually quite elegant for a workaround

3

u/hankDraperCo Aug 22 '18

This is what I've done and it works quite nicely. I knew about matchMedia but it is annoying to manage 2 sets of the same card -- one is scss and the other in js