📅  最后修改于: 2022-03-11 15:03:47.203000             🧑  作者: Mango
var element = document.getElementById('myElement');
var topPos = element.getBoundingClientRect().top + window.scrollY;
var leftPos = element.getBoundingClientRect().left + window.scrollX;