The following code show how to get the width and height of the window in px:
const windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
const windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
Code language: JavaScript (javascript)
Was this tutorial helpful ?