<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> <link type="text/css" rel="stylesheet" href="css/layui/css/layui.css"> <script type="text/javascript" src="css/layui/layui.js"></script> </head> <body> <div class="layui-carousel" id="test2"> <div carousel-item=""> <div>条目1</div> <div>条目2</div> </div> </div> <!-- elem: '#test1' //id选择器 width: '500px' //设置容器宽度 arrow: 'always' //始终显示箭头,可选hover,none anim: 'updown' //切换动画方式,可选fade,default full: false //全屏 autoplay: true //自动切换 interval: 1000 //自动切换的时间间隔 index: 3 //初始化时item索引,默认时0 indicator:'inside' //指示器位置,可选outside,none --> <script> var insbe; layui.use('carousel', function() { var carousel = layui.carousel; //建造实例 disbe = carousel.render({ elem: '#test2', width: '620px', height: '150px', arrow: 'hover', anim:'fade', interval: 3000 }); }); </script> </body>
</html>
|