标签:str exp var else 框架 color ESS view init
<div class="layui-carousel" id="carouselView"> <div carousel-item="" id="preview"> </div> </div>
function initCarousel(){
layui.use([‘carousel‘, ‘form‘], function(){
var carousel = layui.carousel;
$.ajax({
url:‘GetCarouselServlet‘,
type:‘post‘,
data:{
isDisplay:1
},
dataType:‘json‘,
success:function (data) {
$.each(data,function (i,n) {
var str = ‘<div>\n‘ +
‘ <img src="../upload/‘+n.picUrl+‘" style="width: 600px;height: 320px;">\n‘ +
‘ </div>‘;
$(‘#preview‘).append(str);
});
//改变下时间间隔、动画类型、高度
var ins = carousel.render({
elem: ‘#carouselView‘
,interval: 2000
,arrow: ‘always‘
,anim: ‘default‘
,width:‘600px‘
,height:‘320px‘
});
ins.reload({
elem: ‘#carouselView‘
,interval: 2000
,arrow: ‘always‘
,anim: ‘default‘
,width:‘600px‘
,height:‘320px‘
});
},
error:function () {
alert("数据库查询失败,请联系管理员!")
}
});
});
}
initCarousel();
标签:str exp var else 框架 color ESS view init
原文地址:https://www.cnblogs.com/foreversword/p/12627899.html