Skip to content

Commit e1130c1

Browse files
committed
ignore width, height, columns input when setting manual breaks
1 parent 5473df5 commit e1130c1

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

samples/sample14.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@
2727
$(function(){
2828
$('#hidden-wrapper a').click(function(){ alert("boo!"); });
2929
$('#hidden-wrapper').columnize({
30-
manualbreaks:true,
30+
width:1,
31+
height:1,
32+
columns:1000,
33+
manualBreaks:true,
3134
target: "#target"
3235

3336
});

src/jquery.columnizer.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
// column widths, but will take slightly longer
3636
accuracy : false,
3737
// don't automatically layout columns, only use manual columnbreak
38-
manualbreaks : false
38+
manualBreaks : false
3939
};
4040
var options = $.extend(defaults, options);
4141

@@ -52,7 +52,7 @@
5252
var $cache = $('<div></div>'); // this is where we'll put the real content
5353
var lastWidth = 0;
5454
var columnizing = false;
55-
var manualbreaks = options.manualbreaks;
55+
var manualBreaks = options.manualBreaks;
5656

5757
var adjustment = 0;
5858

@@ -120,7 +120,7 @@
120120
//
121121
// add as many nodes to the column as we can,
122122
// but stop once our height is too tall
123-
while((manualbreaks || $parentColumn.height() < targetHeight) &&
123+
while((manualBreaks || $parentColumn.height() < targetHeight) &&
124124
$pullOutHere[0].childNodes.length){
125125
var node = $pullOutHere[0].childNodes[0]
126126
//
@@ -227,7 +227,7 @@
227227
// the column and exit
228228
$putInHere.append($clone);
229229
$cloneMe.remove();
230-
}else if (manualbreaks){
230+
}else if (manualBreaks){
231231
// keep adding until we hit a manual break
232232
$putInHere.append($clone);
233233
$cloneMe.remove();
@@ -358,9 +358,13 @@
358358
lastWidth = $inBox.width();
359359

360360
var numCols = Math.round($inBox.width() / options.width);
361+
var optionWidth = options.width;
362+
var optionHeight = options.height;
361363
if(options.columns) numCols = options.columns;
362-
if(manualbreaks){
364+
if(manualBreaks){
363365
numCols = $cache.find(".columnbreak").length + 1;
366+
optionWidth = false;
367+
364368
}
365369
// if ($inBox.data("columnized") && numCols == $inBox.children().length) {
366370
// return;
@@ -386,9 +390,9 @@
386390
if(options.overflow){
387391
maxLoops = 1;
388392
targetHeight = options.overflow.height;
389-
}else if(options.height && options.width){
393+
}else if(optionHeight && optionWidth){
390394
maxLoops = 1;
391-
targetHeight = options.height;
395+
targetHeight = optionHeight;
392396
scrollHorizontally = true;
393397
}
394398

@@ -538,7 +542,7 @@
538542
// it's scrolling horizontally, fix the width/classes of the columns
539543
$inBox.children().each(function(i){
540544
$col = $inBox.children().eq(i);
541-
$col.width(options.width + "px");
545+
$col.width(optionWidth + "px");
542546
if(i==0){
543547
$col.addClass("first");
544548
}else if(i==$inBox.children().length-1){
@@ -548,7 +552,7 @@
548552
$col.removeClass("last");
549553
}
550554
});
551-
$inBox.width($inBox.children().length * options.width + "px");
555+
$inBox.width($inBox.children().length * optionWidth + "px");
552556
}
553557
$inBox.append($("<br style='clear:both;'>"));
554558
}

0 commit comments

Comments
 (0)