Answers for "width and height in js"

0

width and height in js

const heightOutput = document.querySelector("#height");
const widthOutput = document.querySelector("#width");

function resizeListener() {
  heightOutput.textContent = window.innerHeight;
  widthOutput.textContent = window.innerWidth;
}

window.addEventListener("resize", resizeListener);
Posted by: Guest on April-16-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language