Obtenha o tamanho da janela JavaScript
const window {
width: window.innerWidth,
height: window.innerHeight
}
Cheerful Cockroach
const window {
width: window.innerWidth,
height: window.innerHeight
}
// better than using window.innerWidth / window.innerHeight
// because of scrollbars
const client = {
width: document.documentElement.clientWidth,
height: document.documentElement.clientHeight
}
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML =
"Screen width is " + screen.width;
</script>