Right now I fix it like this:
- init the menu
- if it has any submenus, pick them
- for each submenu, look for all the anchor tags and compute the longest text's length
- for that submenu, set the min-width for all its anchor tags at (max * constant) px
but still I need to find a good constant, I'm using 8 right now.
Here is my code:
- submenu.each(function() {
- var l = 0;
- $('> li > a', this).each(function() {
- l = Math.max(l, $(this).text().trim().length);
- }).css('min-width', (l * 8) + 'px');
- });