日期:2014-05-16 浏览次数:20339 次
<script type="text/javascript"> $(function(){ $('.images a').css({"float":"left"}); $('.images').each(function(){ var w=0; $(this).find("a").each(function(){ w+=$(this).width(); }) $(this).css({"width":w}).parent().css({"width":w}); }) }); </script> <div id="aa"> <div class="images"> <a><img src="b/1.jpg" style="width:160px;height:160px"/></a> <a><img src="b/2.jpg" style="width:160px;height:160px"/></a> <a><img src="b/4.jpg" style="width:80px;height:160px"/></a> <a><img src="b/2.jpg" style="width:170px;height:160px"/></a> </div> </div> <div id="bb"> <div class="images"> <a><img src="b/1.jpg" style="width:160px;height:160px"/></a> <a><img src="b/2.jpg" style="width:160px;height:160px"/></a> <a><img src="b/3.jpg" style="width:380px;height:160px"/></a> </div> </div> <div id="cc"> <div class="images"> <a><img src="b/1.jpg" style="width:160px;height:160px"/></a> <a><img src="b/2.jpg" style="width:160px;height:160px"/></a> </div> </div>