[thelist] dom gives me a headache
rudy
r937 at interlog.com
Fri Dec 14 20:43:05 CST 2001
>> are offsetLeft and offsetTop relative to something?
>
> If you're dealing with nested blocks of any kind at all you'll want to
> account for the parent element(s) as well...
thanks ben, that was the right answer
today must be my lucky day, because i found *exactly* what i needed on the
first page of google search results
i was looking for a tutorial, actually, using the search string "offsetTop
AND offsetLeft AND position" and i can't believe i found a ready made
script --
http://www.mattkruse.com/javascript/anchorposition/
anybody interested in this should read that source code
better make a stiff drink first, you'll be there a while
i had no idea the document object model was so complex
you'd think there would be a couple variables floating around with an
object's offsets, but no, you gotta climb the friggin dom tree adding up
all the offsets until you reach a null parent (hmmm, sounds vaguely like a
reflexive database table relationship...)
there is no way i could've written anything like that kruse script
my thanks to ben and rory and everyone who spent time thinking about this,
and if anybody needs to modify the HM scripts to pop up in fixed positions,
give me a shout, it's tricky ;o)
rudy
More information about the thelist
mailing list