Reputation: 999
I have the following jQuery code which gets and applies the width of the parent li and applies the width to the child ul which works fine:
$('nav.boxnavigation ul li').each(function () {
$(this).find('ul').width($(this).outerWidth(true));
});
I want to use this but instead set this to min-width rather than width, i know this is potentially using .css but cannot get this to work, I am unsure exactly what the code above is doing above to set the width.
Upvotes: 0
Views: 289
Reputation: 167172
Instead of the above code you need to use the below one:
$('nav.boxnavigation ul li').each(function () {
$(this).find('ul').css("min-width", $(this).outerWidth(true));
});
So this would work.
Upvotes: 3