getBoundingClientRect用於獲取某個元素相對於視窗的位置集合。集合中有top, right, bottom, left等屬性。
1.語法:這個方法沒有參數。
rectObject = object.getBoundingClientRect();
function inputKeydown(e){
console.log(e.target.getBoundingClientRect());//bottom:199height:19left:360right:380top:180width:20x:360y:180
}
記錄一下備用:
https://www.cnblogs.com/Songyc/p/4458570.html
