#1403 new
George Kneif

Possible error in ‘cumulativeOffset’

Reported by George Kneif | October 5th, 2012 @ 11:11 AM

My task is to drag a floating text over a picture. I obtain the picture position via ‘Position.cumulativeOffset’ and the mouse pointer position via ‘Event.pointerX’ and ‘Event.pointerY’. It has worked fine on webpages with a simple ‘ridge’ border. Unfortunately some browsers do not render ‘ridge’ borders correctly so I decided to write a new template where I draw the border. ‘Position.cumulativeOffset’ has returned incorrect values.

The structure of the new template is as follows:

  1. ‘center’ (yes, I know I should not use it but convenient)
  2. ‘div id=Lbase, width=828px, pos=rel/0/10px, no border’
  3. ‘div id=La, width=814px, pos=rel/0/0, border-width=7px’
  4. ‘div id=Lb, width=800px, pos=rel/0/0, border-width=7px’
  5. ‘div id=contents, width=800px, rel/0/0, no border’

‘Position.cumulativeOffset’ returns the same value for ‘Lbase’ and ‘contents’, i.e. it ignores the width of the two borders. Consequently the picture position is given 14 pixels less. I have added the 14 pixels to the picture position and the program now works correctly.

This error is consistent in all five browsers on my machine.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

The Prototype JavaScript library.

Shared Ticket Bins

People watching this ticket