public static class Layout extends Object
This class is typically used by higher-level widgets to implement layout on their behalf. It is intended to wrap an element (usually a <div>), and lay its children out in a predictable fashion, automatically accounting for changes to the parent's size, and for all elements' margins, borders, and padding.
To use this class, create a container element (again, usually a <div>)
and pass it to #Layout(Element)
. Rather than attaching child elements
directly to the element managed by this Layout
, use the
Layout.attachChild(Element)
method. This will attach the child
element and return a Layout.Layer
object which is used to manage the
child.
A separate Layout.Layer
instance is associated with each child
element. There is a set of methods available on this class to manipulate the
child element's position and size. In order for changes to a layer to take
effect, you must finally call one of #layout()
or
#layout(int)
. This allows many changes to different layers to be
applied efficiently, and to be animated.
On most browsers, this is implemented using absolute positioning. It also contains extra logic to make IE6 work properly.
NOTE: This class will only work in standards mode, which requires that the HTML page in which it is run have an explicit <!DOCTYPE> declaration.
NOTE: This class is still very new, and its interface may change without warning. Use at your own risk.
Copyright © 2018. All rights reserved.