Created
June 17, 2009 22:15
-
-
Save imagehat/131548 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Split into two columns accounting for nested list items | |
var midway = Math.round($('#sitemap li').length / 2); | |
var $node = $('#sitemap li:eq('+midway+')'); | |
var $parent = $node.parent().parent(); | |
var marker = ( $parent.is('li') ) ? $('#sitemap > li').index($parent) : $('#sitemap > li').index($node); | |
$('#sitemap > li').each(function(i) { | |
if (i > marker) $(this).addClass('colsplit'); | |
}); | |
$('#sitemap li.colsplit').insertAfter('#sitemap').wrapAll('<ul class="columns-2"></ul>').removeClass('colsplit'); | |
$('#sitemap').addClass("columns-2"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment