【Jquery】根据元素个数给予宽度

方法一:

$(document).ready(function(){
    $(".xn_mc_solu_2_ul").css("width", $(".xn_mc_solu_2_ul").children().length * $(".xn_mc_solu_2_ul li").outerWidth(true) )
});

方法二:

$li.each(function() {
    w+=parseInt($(this).outerWidth(true));
});
$ul.width(w+2);
 
原文地址:https://www.cnblogs.com/langting/p/11042107.html