|
沙发
楼主 |
发表于 2020-1-9 11:12:09
|
只看该作者
代码如下:
//配置广告信息
getAdv();
function getAdv(){
var arrPicName = [],
arrPicTime = [],
strNodePath = "MatPic",
strNodeType = "Pic";
var result = getAdvInfo.getAdvInfo(strNodePath, arrPicName, arrPicTime, "","",strNodeType);
var AdvHtml="";
if (result) {
var k = 0;
for (var i = 0, len = arrPicName.length; i < len; i++) {
if(arrPicName[i]!=undefined){
AdvHtml = AdvHtml + "<div class='swiper-slide'><img style='width:53vw; height:29.7vw' src='MatPic/" + arrPicName[i] + "'></div>";
k++;
}
}
if (k == 0) {
AdvHtml = AdvHtml + "<div class='swiper-slide'><img class='pic' src='Picture\\AdvertisementPicture\\waitcard\\ddkh_1.jpg'></div>";
AdvHtml = AdvHtml + "<div class='swiper-slide'><img class='pic' src='Picture\\AdvertisementPicture\\waitcard\\ddkh_2.jpg'></div>";
AdvHtml = AdvHtml + "<div class='swiper-slide'><img class='pic' src='Picture\\AdvertisementPicture\\waitcard\\ddkh_3.jpg'></div>";
}
}else{
AdvHtml = AdvHtml + "<div class='swiper-slide'><img class='pic' src='Picture\\AdvertisementPicture\\waitcard\\ddkh_1.jpg'></div>";
AdvHtml = AdvHtml + "<div class='swiper-slide'><img class='pic' src='Picture\\AdvertisementPicture\\waitcard\\ddkh_2.jpg'></div>";
AdvHtml = AdvHtml + "<div class='swiper-slide'><img class='pic' src='Picture\\AdvertisementPicture\\waitcard\\ddkh_3.jpg'></div>";
}
var swiperHtml='<div class="swiper-container">\n'+'<div class="swiper-wrapper">\n'+AdvHtml+'</div>\n'+'</div>';
wsap.addHTML(swiperHtml);
//初始化滑动窗口
var mySwiper = new Swiper('.swiper-container',{
effect : 'cube',
cubeEffect: {
slideShadows: true,
shadow: true,
shadowOffset: 700,
shadowScale: 12,
},
autoplay : 4000,
autoplayDisableOnInteraction : false,
loop : true,
})}; |
|