The correct approach is to use element.getBoundingClientRect():
var rect = element.getBoundingClientRect(); console.log(rect.top, rect.right, rect.bottom, rect.left);
- 5What is "marquee" tag and how I can use it in HTML?
- 10Is it possible to create an HTML button that acts like a link?
- 6Is it possible to Redirect a Web Page in HTML?
- 3Is it possible to create an HTML button that acts like a link to an item on the same page?
- 1How to find Maximum element in Stack?
- 1How to detect a click event outside a DOM element?
- 2How can I set an HTML text input to allow only numeric input?
- 1How to Centered html button link?
- 1How to automatically set the margins of the child element so they become equal.
- 1How to embed link-to inside html button tag ?
- 2How do I check if an element is hidden in jQuery?