jQuery('ul.nav-menu > li > ul').each(function(index, val){
var children = jQuery(val).find('li').length;
var width = (100 / children) + '%';
jQuery(val).find('li').css('width', width);
});
This function counts out how many second level menu items there are and then creates the width percentage based off of the count. Only works well with small sub menus in my opinion.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.