Reputation:
I have a problem of how to write a correct sentence reflecting full css @media query with screen size and screen orientation (example bellow) with JS window.matchMedia
, all I can find is a separate example for size (without orientation) and orientation (without size). What is the right syntax of this CSS example:
@media only screen and (min-width: 483px) and (orientation: landscape) {}
in this code:
if (window.matchMedia("(orientation: portrait)").matches) {
// how to add a screen size to this exact code?
}
Upvotes: 0
Views: 471
Reputation: 944205
It is the same as the CSS. That's the point of it.
window.matchMedia("only screen and (min-width: 483px) and (orientation: landscape)").matches
Upvotes: 3