Columnizer-jQuery-Plugin icon indicating copy to clipboard operation
Columnizer-jQuery-Plugin copied to clipboard

Math.round() should be math.floor() I think

Open conorw opened this issue 12 years ago • 1 comments

Hi,

Please be gentle, this is my first time posting. I love this plugin and I have not seen anything else out there that can do what it does.

Unfortunately I hit a problem in the code when the code works out how many dynamic columns it should make. In line388 it uses Math.round to calculate how many columns there should be, if there is a width of 700px available and the default column width is 400px the math.round will round up to 2 columns and have the columns overlap. If math.floor was used it would round down to 1 column.

    //var numCols = Math.round($inBox.width() / options.width);
var numCols = Math.floor($inBox.width() / options.width);

Also, I am using chrome in conjunction with some Telerik controls and it seems the Jquery resize fires before the telerik resize. I see that you have addressed this type of issue of IE browsers in ln96 -106, but I ended up using the same tatctic for all browsers as follows:

if(!options.buildOnce){
        $(window).resize(function() {
            if(!options.buildOnce){
                if($inBox.data("timeout")){
                    clearTimeout($inBox.data("timeout"));
                }
                $inBox.data("timeout", setTimeout(columnizeIt, 400));
            //}else if(!options.buildOnce){
            //  columnizeIt();
            }else{
                // don't rebuild
            }
        });

I hope some of this helps,

Conor

conorw avatar Feb 14 '13 15:02 conorw

Any chance for this round->floor change to be applied?

ddrozdov avatar Feb 25 '16 13:02 ddrozdov