fix for split single list into multiple vertical columns using jquery

Assume you got single list and you want to split them into multiple columns using below code. hope this is helpful

var cols = 4; //defines no of columns
var container = $(‘.BFlyOut .linkList ul’);
var items = container.find(‘li’);
var itemsPerCol = Math.ceil(items.length / cols); //get Items per column

var stack = []; //array to hold items
for (var i = 0; i < itemsPerCol; i++) {
for (var k = 0; k < cols; k++) {
stack.push(items[i + (itemsPerCol * k)]); //push items into respective columns
container.html(stack).append($(‘<br>’).css({clear:’both’})); //paint the columns in sorted order



I Am suresh(suresh kumar )a Web developer,Freelancer,webdesigner,UI developer from bangalore. Got 6+ yrs of IT experience . I specialize in standards-based XHTML, CSS and JavaScript web development. Each site I develop is built to be search engine friendly (SEO), using the latest development principles and techniques.

You may also like...

1 Response

  1. Strongly suggest adding a “google+” button for the blog!

Leave a Reply

Your email address will not be published. Required fields are marked *