Get the position of a fixed div with jquery

前端 未结 4 2173
伪装坚强ぢ
伪装坚强ぢ 2021-02-07 11:21

I have a div with position \"fixed\" and I want to get the value of its position relative to the whole document while the user scrolls down the page.

So

4条回答
  •  暖寄归人
    2021-02-07 11:31

    you can use .offset() to get the current coordinates of the element relative to the document whereas .position() to get the current coordinates of an element relative to its offset parent.

提交回复
热议问题