Answers for "getboundingclientrect() javascript"

6

getboundingclientrect() javascript

var div = document.getElementById("myDiv");
  var rect = div.getBoundingClientRect();
  x = rect.left;
  y = rect.top;
  w = rect.width;
  h = rect.height;
Posted by: Guest on April-13-2020
2

getBoundingClientRect

// Return the size of an element and its position relative to the viewport:

const rect = obj.getBoundingClientRect();
console.log(rect)
Posted by: Guest on January-15-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language