Huh, so I did some follow up here - I wasn't able to replicate it in JSFiddle. Whatever the problem is seems to be specific to my own environment. Guess I'll just keep bashing and see if I can find what's specifically causing this issue.
Jquery offset shows values relative to fixed parent instead of page
-
10-06-2023 - |
سؤال
I'm having some issues getting the offset of a object which is contained in a fixed parent. I understand that using object.offset() will give the position relative to the whole document, but when I put that object in a fixed container, it then returns the offset relative to the screen you're on.
I'm trying to display another object at a position relative to the first - so if you're at the very top of a page, it'll look fine, but if you've scrolled down then it won't. I've found this when using a JQuery Dialog, but have been able to replicate it on regular objects as well.
Is this expected behavior? If so, is there a way to find the position of an object relative to the document even when contained in a fixed parent?
المحلول