Heim > Fragen und Antworten > Hauptteil
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>lunbo</title>
<link rel ="stylesheet" href="css/css.css" />
<link rel="stylesheet" href="layui/css/layui.css" />
<script src="layui/ layui.js" type="text/javascript"></script>
</head>
<body>
<div class="layui-carousel" id="test1" >
<div carousel-item>
<div style="background: #0000FF; /">666</div>
<div style="background-color: #009E94; /" >2222</div>
</div>
</div>
<!-- 条目中可以是任意内容,如:<img src=""> -->
<script>
layui.use('carousel', function(){
var carousel =layui.carousel;
//建造实例
carousel.render({
elem: '#test1'
,width: '100%' //设置容器宽度
,arrow: 'immer' //始终显示箭头
,anim: 'default' //切换动画方式
});
});
</script>
</body>
</html>