Vue: offsetTop always returns 0
Solution 1:
You most likely have another element (a child of window, body, etc) with the overflow property set to auto or scroll. That is the element you need to get offsetTop
from.
Use development tools to locate the element that owns the scroll bar
, and then use a reference to that element instead of window
.