Sunday, 14 July 2013

Jquery, resize li tags automatically

Heres a bit of code I put together to stretch a menu to to the full width of the page regardless of how many items there are. var orginalwidth = $(".nav").width; var newwidth = 100 / $(".nav li").length; $(".nav li").each( function () { $(this).css("width", newwidth + "%"); } )

No comments: