https://github.com/OwlCarousel2/OwlCarousel2
2. 把CSS放到html裡面
CSS 放到<head>裡面
<link rel="stylesheet" href="dist/owlcarousel/owl.carousel.min.css">
<link rel="stylesheet" href="dist/owlcarousel/owl.theme.default.min.css">
3. JS 放到<body>最下面,記得要先引用jquery
<!-- jQuery -->
<script src="//code.jquery.com/jquery.js"></script>
<!--貓頭鷹跑馬燈的JS-->
<script src="dist/owlcarousel/owl.carousel.min.js"></script>
<!--啟用貓頭鷹-->4. html 我用背景的跑馬燈
<script>
$('.owl-carousel').owlCarousel({
loop:true,
margin:10,
nav:true,
items:1
})
</script>
<div class="owl-carousel">5. 100高的設定 100% height CSS 設定
<div class="item" style="background-image: url(img/b1.jpg);"><h4>1</h4></div>
<div class="item" style="background-image: url(img/b2.jpg);"><h4>2</h4></div>
</div>
html,body{height: 100%;}
body{min-height:100%;}
.owl-carousel{height: 100%;}
.owl-carousel .owl-stage-outer{height: 100%;}
.owl-stage{height: 100%;}
.owl-item {height: 100%;}
.owl-item .item{height: 100%; background-size: cover;background-position: center center;}