Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 div,当浏览器滚动条向上或向下移动时,我需要找到它的位置。这将帮助我检测这个 div 的当前位置,并且根据这个 div 的当前位置,我可以在它上面放置另一个 div。
您可以像这样抓住位置:
var offset = $('#element').offset(); alert(offset.top + offset.left);