The correct approach is to use element.getBoundingClientRect():
var rect = element.getBoundingClientRect(); console.log(rect.top, rect.right, rect.bottom, rect.left);
- 1How to find Maximum element in Stack?
- 5Is it possible to create an HTML button that acts like a link?
- 1What are the main attributes of HTML <hr> Tag?
- 4Is it possible to Redirect a Web Page in HTML?
- 1*ngIf and *ngFor on same element causing error
- 1How to make horizontal line without shade in HTML
- 1how to remove HTML/XML tags from string?
- 2how to generate random color for html element?
- 1how to find next element of current element?
- 1How to set DOM element as the first child?