ProtoLayout uses a series of CSS classes to define box positions on a page:
- lm_container - This is the root level container object that will house your box elements, and the bounds of this container must be defined through your own CSS. All other box classes must be direct children of an lm_container element. The first container element in the document CANNOT be statically positioned. You must define a relative, absolute or fixed position for the top-most container. Any child of a container may also be a container by adding the lm_\container class after its own layout class.
- lm_top, lm_bottom - Top/Bottom rows with fixed height and resizable width. Additional rows will stack vertically from top to bottom according to their position in the document.
- lm_left, lm_right - Left/Right columns with fixed width and resizable height. Additional columns will stack horizontally from left to right according to their position in the document.
- lm_center - Middle content, sized to fit all remaining space between rows and columns. Multiple centers will stack on top of each other according to their position in the document.
- lm_middle - Box is centered vertically and horizontally within the container according to its own width and height. No sizing is performed on this box.
###To include the library into your document place the following in your HEAD:
ProtoLayout requires Prototype 1.6.1 or later.
###Creating a nested layout:
<div class="lm_container"> <div class="lm_top"></div> <div class="lm_left"></div> <div class="lm_center lm_container"> <div class="lm_top"></div> <div class="lm_left"></div> <div class="lm_center"></div> <div class="lm_right"></div> <div class="lm_bottom"> </div> </div> <div class="lm_right"></div> <div class="lm_bottom"></div> </div>
See example.html for a working example.
ProtoLayout is setup to automatically refresh the layout with each browser window resize. If you need to trigger a manual resize (for animating panels, for example) you can call ProtoLayout.resize() to trigger the refresh. This function can be used directly in an event handler and does not require rebinding to function.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.