Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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);
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #width #height #js
ADD COMMENT
Topic
Name
5+4 =