- 以百度搜索框为例
let search = document.getElementById('kw');
let rect = search.getBoundingClientRect();
let bodyRect = document.body.getBoundingClientRect();
let top = rect.top - bodyRect.top
let left = rect.left - bodyRect.left
let search = document.getElementById('kw');
let rect = search.getBoundingClientRect();
let bodyRect = document.body.getBoundingClientRect();
let top = rect.top - bodyRect.top
let left = rect.left - bodyRect.left