jquery offset values changes by scrolling the page

前端 未结 6 1700
南旧
南旧 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:54

    I am having the same problem while editing a old website the workaround I find out is to use $(selector)[0].offsetTop instead of $(selector).offset().top and it is working fine for me right now.

提交回复
热议问题