Prototype.js based box layout manager
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
libs
ProtoLayout.js
README.md
example.html

README.md

#ProtoLayout A prototype.js based box layout manager.
Originally derived from Xilinus Simple Layout Manager
Copyright (c) 2010, Jarvis Badgley - chiper[at]chipersoft[dot]com

Usage

ProtoLayout uses a series of CSS classes to define box positions on a page:

Flow Graphic

###Classes:

  • 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:

<script type="text/javascript" src="libs/prototype-1.6.1.js"></script>
<script type="text/javascript" src="ProtoLayout.js"></script>

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.resize()

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.

License

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.