سؤال

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?

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top