Revision: 26278
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 22, 2010 08:58 by smashu
Initial Code
var splitList = function(listClass) { var originalList = $(listClass); var originalItems = originalList.children(); var splitAt = Math.round(originalItems.length/2); //clone it but hide it var cloneList = originalList.clone().insertAfter(originalList).css('display','none'); var clonedItems = cloneList.children(); //remove first half of LIs from clone list for (var i=0; i<clonedItems.length; i++) { if(i < splitAt) { $(clonedItems[i]).remove(); } } //remove last half of LIs from original list for (var i=0; i<originalItems.length; i++) { if(i >= splitAt) { $(originalItems[i]).remove(); } } //show it cloneList.css('display','block'); }
Initial URL
Initial Description
Initial Title
jquery split list in 2 columns
Initial Tags
list, jquery
Initial Language
JavaScript