MooColumns 0.67 beta
MooColumns is a MooTools 1.2 class that allows you to divide content into multiple columns quickly and easily.
Syntax:
html:
- <link rel="stylesheet" href="css/mooColumns.css" type="text/css" media="all" />
- ...
- <div class="multiColumn">Content Here</div>
- ...
- <script type="text/javascript" src="js/mootools-1.2-core-yc.js" ></script>
- <script type="text/javascript" src="js/MooColumns_0.66.js" ></script>
javascript:
- var myColumns = new MooColumns({});
Options:
-
selector [string]: css style selector to determine what elements get MooColumns. Default = ".multiColumn"
-
className [string]: Determines main classname used. Default = "multiColumn"
-
numOfColumns [number]: Default = 2
-
gutterWidth [number]: Percent based by default, can use pixel measurement via a string such as "20px". Default = 5
-
gutterClassName [string]: Default ="gutter"
-
columnClassName [string]: Default = "column"
-
tweak [object]
-
width [number]: Overall width adjustment (in px) for multi-column area. Default = 0.
-
x [number]: Left edge adjustment (in px) for multi-column area. Default = 0.
-
y [number]: Top edge adjustment (in px) for multi-column area. Default = 0.
-
splittableElements [array]: Array of splittable elements. Default = [ 'p', 'div', 'span', 'ul' ]
-
morePrecise [boolean]: When true script may be slower but will be more precise. Default = true
-
tolerance [number]: How far (in px) below the target bottom non-splittable elements can hang before they are moved to the next column. Default = 10
-
colBreaksTrump [boolean]: When true and there are column breaks present, they will be used instead of auto-calculating where to divide the content. Useful if you want full control over where the splitting occurs. Default = true
Examples:
-
- var myColumns = new MooColumns({});
-
-
- var TripleColumns = new MooColumns({ numOfColumns:3 });
-
-
- var moreColumns = new MooColumns({ selector:'#article', numOfColumns:3 });
-
-
-
-
- var myTweakedColumns = new MooColumns({
- tweak:{
- width:-10,
- x:10,
- y:10
- },
- numOfColumns:3
- });
Notes:
Column Breaks: MooColumns looks for either a span with the class of "colBreak" or two consecutive horiztonal rule elements to use as the column breaks.
Requirements: MooTools 1.2 Core.
Compatibility: All A-grade browsers..
The creation of a MooColumns instance must be wrapped in a domready event.
- window.addEvent('domready', function() {
- var myColumns = new MooColumns({});
- });
Download