I have ... questions about these functions too. I have attempted to use them at 
different times, obtaining results other than what I expected. However messing 
round, mixing and matching, etc has yielded me proper results. From what I 
understand (which is probably not all correct) I see the functions as follows:

realOffset - Returns and array in the format of [scrollX, scrollY]. When you 
have elements positioned within DIV's that have overflow:auto and the user has 
scrolled the containing DIV, a scroll offset is created. Depending whether the 
vertical, horizontal, or both scroll bars have been moved, the values will need 
to be applied to some absolute positioning calculations (cumulativeOffset). 
element.top + realOffset(element)[0] and element.top + realOfffset(element)[1].

cumulativeOffset - Positioning of an object as if there were no scroll offsets. 
IE The position an object has from the document top left corner with out any 
nested scrolling applied. If you don't have any scrollable DIV's 
(overflow:auto) this will be your exact positioning.

positionedOffset - I don't know for sure. I'm assuming its cumulativeOffset + 
realOffset. 

page - ?



Most of this is from memory and I didn't look at the latest source. I didn't 
even know there was a "page" function due to the fact that my company has 
frozen its prototype library for now. Also: www.prototypedoc.com . It is 
slightly outdated but some of the base functionality is documented heavily 
through various sites. The first site ( 
www.sergiopereira.com/articles/prototype.js.html ) was my starting place 
oh-so-long-ago with Prototype.

-Andrew Martinez

 -----Original Message-----
From:   [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]  On Behalf Of Eric Anderson
Sent:   Monday, May 15, 2006 10:12 PM
To:     [email protected]
Subject:        [Rails-spinoffs] Positioning

I'm trying to understand the Position object. Specially the various 
offset methods. From looking at the code I think I may understand them 
but I wanted to run it by the group to make sure I had a clear 
understanding.

realOffset - This returns the coordinates of the element as if none of 
the elements on the page are scrollable from the document edge.

cumulativeOffset - This returns the coordinates of the element from the 
document edge (not taking scrolling into account or anything fancy).

positionedOffset - This will return the same thing as cumulativeOffset 
most of the time, but if the element is contained in a positioned 
element ('absolute' or 'relative') then it returns the coordinates from 
the parentOffset of the element (which is the top-level element that is 
actually positioned).

page - This is the one I really don't understand. It seems like it is 
calculating the cumulativeOffset - realOffset. But I can't figure out 
the purpose or why it is called "page".

Any pointers anyone could give to help me understand these methods. Most 
of the documentation I have found on the web basically reads the code to 
me. I am trying to understand what these method really do and why we 
need them.

Eric

_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to