Reputation: 12740
In this example, width is fixed for "My Account" text. What I want to do is to make it dynamic so it should either widen or shrink based on length of the text because, instead of writing "My Account", I'll print full name of user and will always be different.
Menu goes out of current place, When I change position and width values.
If there is simpler example you know, please let me know.
Thanks
Upvotes: 1
Views: 1092
Reputation: 5353
You need to delete all styles that give the drop down a set width, and add $('.submenu').width($('.account').outerWidth());
when the page loads.
jsFiddle: http://jsfiddle.net/fRGqD/1/
Upvotes: 2