recommended
getBoundingClientRect
method
let element = document.getElementById("some-id"); // for jQuery $("#some-id")[0];

let elementRect = element.getBoundingClientRect();
returns
DOMRect
Object
tooltipRect: DOMRect
bottom: -5
height: 20
left: 1093.5625
right: 1149.59375
top: -25
width: 56.03125
x: 1093.5625
y: -25
__proto__: DOMRect
bottom: -5   //invoked
height: 20   //invoked
left: 1093.5625   //invoked
right: (...)
top: (...)
width: (...)
x: (...)
y: (...)
by გიორგი უზნაძე
4 years ago
JavaScript
DOM
3
Pro tip: use ```triple backticks around text``` to write in code fences