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
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.