Return to Snippet

Revision: 49873
at August 1, 2011 14:15 by buzzswarbrick


Initial Code
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'});
    })
}

Initial URL
http://jsfiddle.net/bra4C/

Initial Description
This is a little function that dynamically resizes the navigation, taking into account the size of the item width as well

Initial Title
Dynamic Menu Resizer

Initial Tags
css, navigation, jquery

Initial Language
jQuery