Created
October 23, 2012 20:52
-
-
Save Pushplaybang/3941474 to your computer and use it in GitHub Desktop.
Banging Justified Menu Script.
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
//My Banging Menu Justify Script | |
function bangJustifyMenu() { | |
var menu = $("#productmenu"); | |
var menuWidth = menu.width(); | |
var navItems = menu.find('a'); | |
var navCount = navItems.length; | |
var navContent = 0; | |
navItems.each( function() { | |
var eachWidth = $(this).width(); | |
navContent = navContent + eachWidth; | |
}); | |
var menuRemainder = (menuWidth - navContent) / navCount; | |
console.log(menuRemainder); | |
navItems.each( function() { | |
$(this).css({ | |
'padding-left' : menuRemainder / 2, | |
'padding-right' : menuRemainder / 2 | |
}); | |
}); | |
} // end menu justify |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment