1 (function( $, undefined ) {
3 $.fn.grid = function( options ) {
4 return this.each(function() {
10 $kids = $this.children(),
11 gridCols = { solo:1, a:2, b:3, c:4, d:5 },
16 if ( $kids.length <= 5 ) {
17 for ( var letter in gridCols ) {
18 if ( gridCols[ letter ] === $kids.length ) {
24 $this.addClass( "ui-grid-duo" );
27 iterator = gridCols[grid];
29 $this.addClass( "ui-grid-" + grid );
31 $kids.filter( ":nth-child(" + iterator + "n+1)" ).addClass( "ui-block-a" );
34 $kids.filter( ":nth-child(" + iterator + "n+2)" ).addClass( "ui-block-b" );
37 $kids.filter( ":nth-child(" + iterator + "n+3)" ).addClass( "ui-block-c" );
40 $kids.filter( ":nth-child(" + iterator + "n+4)" ).addClass( "ui-block-d" );
43 $kids.filter( ":nth-child(" + iterator + "n+5)" ).addClass( "ui-block-e" );