编程语言/getBoundingClientRect:修订间差异
来自康健生活
| 第73行: | 第73行: | ||
: (offsetLeft + triggerRefWidth/2 + prefix[0]) | : (offsetLeft + triggerRefWidth/2 + prefix[0]) | ||
} | } | ||
root.current.style.position = container === document.body ? 'fixed' : 'absolute'; | // 这行代码放在此处,会丢失 margin-top | ||
// root.current.style.position = container === document.body ? 'fixed' : 'absolute'; | |||
root.current.style.top = offsetTop + 'px'; | root.current.style.top = offsetTop + 'px'; | ||
root.current.style.left = offsetLeft + 'px'; | root.current.style.left = offsetLeft + 'px'; | ||