Posted By

buzzswarbrick on 08/01/11


Tagged

css navigation jquery dynamic resizing


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

spee66


Dynamic Menu Resizer


 / Published in: jQuery
 

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

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

  1. function resizeMenu($navItem, menuWidth){
  2. var sizeConcat = 0
  3. $navItem.each(function(e){
  4. sizeConcat += $(this).width()
  5. })
  6.  
  7. var widthDif = ((menuWidth-(sizeConcat))/$navItem.length-1)
  8.  
  9. $navItem.each(function(e){
  10. var itemWidth = Math.round(widthDif + $(this).width())
  11. $(this).css({'width': itemWidth +'px'});
  12. })
  13. }

Report this snippet  

You need to login to post a comment.