1.獲取元素絕對位置

question:不依賴框架,如何獲取一個元素的絕對位置?

1.1 offset和position理解

1.2 使用框架

1.3 不適用框架

方法一:offsetTop和offsetLeft循環offsetParent獲得offsetTop和offsetLeft相加
方法二:getBoundingClientRect

1.4 理解window、document、documentElement和body四個元素的定義和區別

相關文章
相關標籤/搜索