Results 1 to 2 of 2
Feb 15, 2013, 08:17 #1
- Join Date
- Mar 2006
- High Wycombe UK.
- 0 Post(s)
- 0 Thread(s)
offsetTop returning value relative to fixed element
EDIT: dam. the title of this post is misleading, its more "position absolute relative to fixed element", I believe the offset is being calculated correctly. Note that the fixed and absolute elements are completely separate. And i've just realised this is probably in the wrong forum, bahhhhh sorry guys.
I've got a bit of a weird one here. I have a nav bar (with an add above it) that turns position:fixed; as the user scrolls down past it so it always remains in view right at the top of the page:
My problem is that when this happens, my model popup which i have positioned absolute using the offset top and left of the click trigger gets bumped down 40px. As if the absolute positioning is relative to my fixed nav bar. This is in chrome btw.
I have tried using jquery .position instead of .offset but i'm pretty sure jquery is just getting the offset of the parent then minusing it from the offset of the child so it hits the same bugg.
Not sure what to do here, its a bugg that i had not anticipated and one i cant seems to find a work around to, googling it is a terminology minefield. My best guess at the moment is to try to approximate position: fixed; with some combination of other positioning but its just like 'ahhhhhhh' cause this should not be happening in the first place.
NickNever stop kicking me.