jquery 两个为一组外层加一个div

        // 每两个为一组包裹起来
        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>");

posted @ 2015-01-16 14:12  nimoer  阅读(646)  评论(0编辑  收藏  举报