A possible alternative (untested!) to ponder upon... function balance(list,cssClass){ // new second 'half' of list... var to = jQuery('<ul></ul>'),attr({id:list+'-b',class:cssClass}) // original list, with new id and class, and new list placed after... , from = jQuery('#'+list).attr({id:list+'- a'}).addClass(cssClass).after(to) // list of items... , items = jQuery('li', from) ; // move bottom 'half' of list from from to to... to.append( items.slice(Math.ceil(items.length/2), items.length) ); }
On Dec 18, 5:14 pm, Alex <[EMAIL PROTECTED]> wrote: > Another patch, as I realized I needed to round the number of list > items, otherwise it wouldn't work with uneven lists. Replace > > var itemsLength = items.length/2; > > with > > var itemsLength = Math.round(items.length/2);