Position Atom feed
As of Prototype 1.6, the complete Position
object has been deprecated in favor of methods on the Element
object.
The Position
object provides a series of methods that help with element positioning and layout-related issues. These are mainly used by third party UI libraries like script.aculo.us.
Methods
absolutize
deprecated
absolutize(element)
Turns element
into an absolutely-positioned element without changing its position in the page layout.
clone
deprecated
clone(source, target[, options]) -> [Number, Number]
Clones the position and/or dimensions of source
onto target
as defined by the optional argument options
.
cumulativeOffset
deprecated
cumulativeOffset(element) -> [Number, Number]
Returns the offsets of element
from the top left corner of the document.
offsetParent
deprecated
offsetParent(element) -> HTMLElement
Returns element
’s closest positioned ancestor. If none is found, the body
element is returned.
overlap
deprecated
overlap(mode, element) -> Number
Returns a Number between 0
and 1
corresponding to the proportion to which element
overlaps the point previously defined by Position.within. mode
can be set to either vertical
or horizontal
.
page
deprecated
page(element) -> [Number, Number]
Returns the X/Y coordinates of element
relative to the viewport.
positionedOffset
deprecated
positionedOffset(element) -> [Number, Number]
Calculates the element’s offset relative to its closest positioned ancestor (i.e., the element that would be returned by Position.offsetParent(element).
prepare
deprecated
prepare()
Calculates document scroll offsets for use with Position.withinIncludingScrolloffsets.
realOffset
deprecated
realOffset(element) -> [Number, Number]
Calculates the cumulative scroll offset of an element in nested scrolling containers.
relativize
deprecated
relativize(element)
Turns element
into an relatively-positioned element without changing its position in the page layout.
within
deprecated
within(element, x, y) -> Boolean
Indicates whether the point x, y
(measured from the top-left corner of the document) is within the boundaries of element
. Must be called immediately before Position.overlap.
withinIncludingScrolloffsets
deprecated
withinIncludingScrolloffsets(element, x, y) -> Boolean
Indicates whether the point x, y
(measured from the top-left corner of the document) is within the boundaries of element
. Used instead of Position.within whenever element
is a child of a scrolling container. Must be called immediately before Position.overlap and immediately after Position.prepare.