📌  相关文章
📜  js 获取元素窗口偏移顶部 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:03:47.203000             🧑  作者: Mango

代码示例1
var element = document.getElementById('myElement');
var topPos = element.getBoundingClientRect().top + window.scrollY;
var leftPos = element.getBoundingClientRect().left + window.scrollX;