In css I have this
@media screen and (max-width: 860px) { } what would be the equivalent javascript code to get the same width value that the css uses for @media max-width?
Thanks
I believe that there is no way to get CSS from JavaScript code without parsing CSS file. JavaScript has a similar method is matchMedia. Usage:
if (window.matchMedia("(min-width: 400px)").matches) { /* the viewport is at least 400 pixels wide */ } else { /* the viewport is less than 400 pixels wide */ }
window.innerWidthinnerWidth