If I'm understanding this correctly, screen.width
is the JavaScript analogue of
device-width
in a CSS media query.
What would be correct JavaScript for max-device-width
and min-device-width
?
If I'm understanding this correctly, screen.width
is the JavaScript analogue of
device-width
in a CSS media query.
What would be correct JavaScript for max-device-width
and min-device-width
?
The CSS max-device-width
and min-device-width
operators are predicates, so in JavaScript they would be checked with relational operators:
if (screen.width >= 100) // (min-device-width: 100)
if (screen.width <= 1000) // (max-device-width: 1000)