[Durham] Spare RAM

Oliver Burnett-Hall olly at burnett-hall.co.uk
Wed Jun 17 19:54:41 UTC 2009

On 17/06/2009, Scott Wilcox <sc0tt at x0f.org> wrote:
> Now, when pulling the points of the note box, I have the x,y relative to
> the image itself. I'm trying to grab the position of the parent element
> then adding that to the x,y to give me the final position.
> The problem is that when I'm trying to get the position of the parent
> element, I'm getting different results in browsers and the locations are
> off by about 50px;

It's a long time since I've done much browser-based Javascript (I was
hoping that you'd have a language query!), so I'm not sure how much
I'll be able to help with this.

How are you attempting to do this?  And what browsers does this need
to work on?  There are quite a lot of rendering issues that you could
be running into.  And things get much, much harder if IE5 is a target

The way I'd approach this problem (which is probably not the right
way) is to forget Javascript for a while, and work on getting a CSS
style that can correctly position a <div/> element relative to the
image on all target browsers.  Write a static HTML page and tweak
until it works.  When you've got this, all you'll have to do is use
Javascript to fetch the coordinates and information to be displayed,
then created the div and style it, offsetting it as required.

- olly

More information about the Durham mailing list