加载中...
加载中...
layui.carousel通用轮播组件重新加载

layui.carousel通用轮播组件重新加载 原创

通用轮播组件文档 - layui.carousel

 https://www.layui.com/doc/modules/carousel.html  

/**********carousel 轮播 start**********/
//通用轮播组件文档 - layui.carousel https://www.layui.com/doc/modules/carousel.html
//图片轮播
var ins;
var options = {
elem: '#test10'
,width: '100%'
,height: '320px'
,arrow: 'always' //始终显示箭头
,nim: 'updown' //切换动画方式
,autoplay: true
,interval: 3000
}
update_carousel();
function update_carousel(){
layui.use(['carousel', 'form'], function(){
var carousel = layui.carousel
,form = layui.form;

//图片轮播
ins =carousel.render(options);

var $ = layui.$, active = {
set: function(othis){
var THIS = 'layui-bg-normal'
,key = othis.data('key')
,options = {};

othis.css('background-color', '#5FB878').siblings().removeAttr('style');
options[key] = othis.data('value');
ins3.reload(options);
}
};

//监听开关
form.on('switch(autoplay)', function(){
ins3.reload({
autoplay: this.checked
});
});

$('.demoSet').on('keyup', function(){
var value = this.value
,options = {};
if(!/^\d+$/.test(value)) return;

options[this.name] = value;
ins3.reload(options);
});

//其它示例
$('.demoTest .layui-btn').on('click', function(){
var othis = $(this), type = othis.data('type');
active[type] ? active[type].call(this, othis) : '';
});

//重置轮播
//ins.reload(options);

});
}
/*************carousel 轮播 end**********/


没有更多推荐了 [去首页]
image
文章
376
原创
293
转载
83
翻译
0
访问量
183411
喜欢
73
粉丝
5
码龄
7年
资源
3

文章目录

加载中...
0
0