$(function () {




    $.ajax({
        url:url+"/newspicture/newspicture/listForPage",
        dataType: "json",
        type: "get",
        success: function (response, status, xhr) {
            var arr = [];
            for ( var i=0; i <response.length ; i++){
                if (response.length>0 && response[i].type=='资讯') {
                    arr.push(response[i]);
                }
            }
            var temp = Math.ceil(arr.length/2);
            var left = "";
            var right = "";
            $.each(arr,function (i,item) {
                if(i<temp){
                    left += "<div class='swiper-slide width100' style='height: 124px' title='"+item.jumpurl+"'>" +
                        "<a href='"+item.tourl+"' target='_blank'><div class='width100' style='text-align: center'>" +
                        "<img class='width80' style='height: 95px;' src='"+formatImgUrl(item.img)+"'>" +
                        "</div>" +
                        "<div class='width80 one_line' style='text-align: center'>"+item.jumpurl+"</div></a>"+
                        "</div>";
                }else{
                    right += "<div class='swiper-slide width100' style='height: 124px' title='"+item.jumpurl+"'>" +
                        "<a href='"+item.tourl+"' target='_blank'><div class='width100' style='text-align: center'>" +
                        "<img class='width80' style='height: 95px;' src='"+formatImgUrl(item.img)+"'>" +
                        "</div>" +
                        "<div class='width80 one_line' style='text-align: center'>"+item.jumpurl+"</div></a>"+
                        "</div>";
                }
            });
            $("#leftSwiper").html(left);
            $("#rightSwiper").html(right);
            if(arr.length>=4){
                var mySwiper = new Swiper('.swiper-container', {
                    autoplay: true,//可选选项,自动滑动
                    loop:true,
                    direction:'vertical',
                    slidesPerView: 2
                });
            }
        }
    });


});