From 4440a792b28240e093abc2b7c66b3a469ef25bdd Mon Sep 17 00:00:00 2001 From: Bart De Lepeleer Date: Wed, 16 Apr 2014 17:18:01 +0100 Subject: [PATCH] added maxColWidth parameter --- src/jquery.columnizer.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/jquery.columnizer.js b/src/jquery.columnizer.js index 585ce00..b41a327 100644 --- a/src/jquery.columnizer.js +++ b/src/jquery.columnizer.js @@ -19,6 +19,9 @@ width: 400, // optional # of columns instead of width columns : false, + // Optional, The width of a column can grow to maxColWidth (padding included!). + // Columns will be added if the the container is wider + maxColWidth:false, // true to build columns once regardless of window resize // false to rebuild when content box changes bounds buildOnce : false, @@ -433,6 +436,13 @@ numCols = $cache.find(prefixTheClassName("columnbreak", true)).length + 1; optionWidth = false; } + + if ( options.maxColWidth ){ + numCols=1; + while ( ( numCols * options.maxColWidth ) < $inBox.width() ) { + ++numCols; + } + } // if ($inBox.data("columnized") && numCols == $inBox.children().length) { // return;