以下のコードは、ウィンドウの幅と高さを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)
このチュートリアルは役に立ちましたか?