.getBoundingClientRect()

.getBoundingClientRect() 该方法获得页面中某个元素的左,上,右和下分别相对浏览器视窗的位置,他返回的是一个对象,即Object,该对象有4个属性:top,left,right,bottom;

原文地址:https://www.cnblogs.com/heqinglin/p/5433732.html