Nice code, you can also do it simply using CSS only, without need to any JS code.
The trick here is treating the list as a table
.ui-tabs .ui-tabs-nav{
display: table;
}
.ui-tabs .ui-tabs-nav li{
display: table-cell;
position: static;
float:none;
}
That’s it, it works with any list or div menu.