Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/jquery.columnizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
ignoreImageLoading : true,
// should columns float left or right
columnFloat : "left",
// resize container to width of filled columns only
// works with width and height options set
resizeContainer : false,
// ensure the last column is never the tallest column
lastNeverTallest : false,
// (int) the minimum number of characters to jump when splitting
Expand Down Expand Up @@ -580,6 +583,7 @@
}
}else{
// it's scrolling horizontally, fix the width/classes of the columns
var nonEmptyColumns = 0;
$inBox.children().each(function(i){
$col = $inBox.children().eq(i);
$col.width(optionWidth + "px");
Expand All @@ -591,16 +595,23 @@
$col.removeClass(prefixTheClassName("first"));
$col.removeClass(prefixTheClassName("last"));
}
if($col.html() != ''){
nonEmptyColumns++;
}
});
$inBox.width($inBox.children().length * optionWidth + "px");
if(nonEmptyColumns && options.resizeContainer){
$inBox.width(nonEmptyColumns * optionWidth + "px");
}else{
$inBox.width($inBox.children().length * optionWidth + "px");
}
}
$inBox.append($("<br style='clear:both;'>"));
}
$inBox.find(prefixTheClassName("column", true)).find(":first" + prefixTheClassName("removeiffirst", true)).remove();
$inBox.find(prefixTheClassName("column", true)).find(':last' + prefixTheClassName("removeiflast", true)).remove();
$inBox.data("columnizing", false);

if(options.overflow){
if(options.overflow && options.overflow.doneFunc){
options.overflow.doneFunc();
}
options.doneFunc();
Expand Down