【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);

 

 
posted @ 2019-06-17 20:47  瀚海浪亭  阅读(163)  评论(0编辑  收藏  举报