JavaScript gets a method to specify the location of an element
- 2020-05-27 04:13:30
- OfStack
This example shows how JavaScript gets the location of a specified element. Share with you for your reference. The details are as follows:
function showpane() {
var self = document.getElementById("eID");
var left = self.getBoundingClientRect().left + document.documentElement.scrollLeft;
var top = self.getBoundingClientRect().top + document.documentElement.scrollTop + self.offsetHeight;
}
I hope this article has been helpful to your javascript programming.