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
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to