HTML部分
<div class="AppList"> <li><a href="#" target="_blank"><img src="uploadfiles/image/temp/HomeCase1.jpg" /></a></li> <li><a href="#" target="_blank"><img src="uploadfiles/image/temp/HomeCase2.jpg" /></a></li> <li><a href="#" target="_blank"><img src="uploadfiles/image/temp/HomeCase3.jpg" /></a></li> <li><a href="#" target="_blank"><img src="uploadfiles/image/temp/HomeCase4.jpg" /></a></li> <li><a href="#" target="_blank"><img src="uploadfiles/image/temp/HomeCase5.jpg" /></a></li> <li><a href="#" target="_blank"><img src="uploadfiles/image/temp/HomeCase6.jpg" /></a></li> <li><a href="#" target="_blank"><img src="uploadfiles/image/temp/HomeCase1.jpg" /></a></li> <li><a href="#" target="_blank"><img src="uploadfiles/image/temp/HomeCase2.jpg" /></a></li> <li><a href="#" target="_blank"><img src="uploadfiles/image/temp/HomeCase3.jpg" /></a></li> <li><a href="#" target="_blank"><img src="uploadfiles/image/temp/HomeCase4.jpg" /></a></li> </div>
js部分
$(function() { $div = null; $(".AppList li").each(function(i){ if ( i % 6 == 0) { $div = $( ‘<ul class="item"></ul>‘ ); $div.appendTo(".AppList"); } $(this).appendTo($div); }); });
时间: 2024-08-11 03:30:25