Hello, I'm trying to take a big ul and format it into 2 columns.
What I'm doing is cloning the ul, then floating the clone to the left so that gives me my 2 columns (of the same data). I then get a count of the children, split it in half and show the first half in the left column, the 2nd half in the right column. I'm storing my counts in variables, but it doesn't look like :gt and :lt can accept a numerical value as it's parameter. I've tried passing in parseInt() and new Number() but that doesn't work either. I can hard code a number and it works. But my lists will be dynamic so I can't use a hard number. Does anyone know a way to do this? The columns should read top-down so if you have 100 entires, the left column is 1-50, the right is 51-100, both top-down. Here's the relevant code I'm using: var condition_count = $('#filterlist_wrapper ul li').size(), left_col = condition_count / 2; right_col = condition_count - left_col; //if total count is an odd number, we want to add one to the left column //and subtract one from the right column if (condition_count % 2) { left_col = Math.ceil(left_col); right_col = Math.floor(right_col); console.log('left:' + left_col + ' right:' + right_col); } var column1 = $('#filterlist_wrapper ul'), column2 = column1.clone().attr('id', 'col2'); column2.insertAfter(column1); $('#filterlist_wrapper ul li:gt(44)').css('background', 'yellow'); $('#filterlist_wrapper ul#col2 li:lt(44)').remove(); console.log( $('#filterlist_wrapper ul li').size() );