jquery offset values changes by scrolling the page

前端 未结 6 1697
南旧
南旧 2020-12-15 16:55
var offset = $(selector).offset();

The values of offset variable changes if we scroll the page up and down, i want the exact and fixed offset value

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-15 17:49

    In 2015, the 'correct' answer should no longer be used - offset has been modified. Any code that used the above solution will no longer work properly.

    Solution: Please upgrade jquery to a newer version (works in 1.11.3). Or... change .offset call to use .position instead.

提交回复
热议问题