/ Published in: jQuery
This is a little function that dynamically resizes the navigation, taking into account the size of the item width as well
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function resizeMenu($navItem, menuWidth){ var sizeConcat = 0 $navItem.each(function(e){ sizeConcat += $(this).width() }) var widthDif = ((menuWidth-(sizeConcat))/$navItem.length-1) $navItem.each(function(e){ var itemWidth = Math.round(widthDif + $(this).width()) $(this).css({'width': itemWidth +'px'}); }) }
URL: http://jsfiddle.net/bra4C/