// 每两个为一组包裹起来
var slides2n = $("#frame").find(".phone-screen:nth-child(2n)").each(function(i){
slides.slice(i*2,i*2+2).wrapAll("<div class='ipad-screen swiper-slide clearfix'></div>");
});
//剩下的再用div包起来
slides.slice(slides2n.length * 2).wrapAll("<div class='ipad-screen swiper-slide clearfix'></div>");
转载于:https://www.cnblogs.com/nimoer/p/4228589.html