js获取div对象几何信息

/**
* @description 获取对象信息:
* bottom: 208
* height: 200 (老版本IE不兼容)
* width: 200 (老版本IE不兼容)
* left: 8
* right: 208
* top: 8
* x: 8
* y: 8
* @returns
*/

var div = document.getElementById("div");
console.log(div.getBoundingClientRect());

相关文章