我试图让猫头鹰旋转木马2在我的
PHP网站上工作.除了功能之外,我在Anguler网站上使用了完全相同的代码.所以这应该工作.这是我的脚本和链接
jQuery(document).ready(function(){ jQuery('#owl2').owlCarousel({ navigation: true,nav: true,dots: false,margin: 50,dotsEach: false,dotData: false,center: true,autoWidth: true,items: 5,center:true,slideSpeed: 300,paginationSpeed: 400,autoplay: false,responsive:{ 0:{ items:1 },600:{ items:3 },1000:{ items:5 } } }); });
HTML
<div class="container"> <div class="row"> <div class="col-md-12"> <div id="owl2" class="owl-carousel owl-theme"> <div class="item verticle-align"> <img class="verticle-align" src="img/Metabo.png" alt=""> </div> <div class="item"> <img class="verticle-align" src="img/aeroquip.png" alt=""> </div> <div class="item"> <img class="verticle-align" src="img/IR.png" alt=""> </div> <div class="item"> <img class="verticle-align" src="img/huck.png" alt=""> </div> <div class="item"> <img class="verticle-align" src="img/infasco.png" alt=""> </div> <div class="item"> <img class="verticle-align" src="img/Metabo.png" alt=""> </div> <div class="item"> <img class="verticle-align" src="img/chicago-pneumatic.jpg" alt=""> </div> <div class="item"> <img class="verticle-align" src="img/Gesipa.jpg" alt=""> </div> </div> </div> </div> </div>
和我的链接
<!-- Bootstrap --> <link rel="stylesheet" type="text/css" href="css/boot/bootstrap.css"> <link rel="stylesheet" type="text/css" href="css/boot/bootstrap-theme.css"> <!--owl css--> <link rel="stylesheet" type="text/css" href="css/owl_carousel/owl.carousel.css"> <link rel="stylesheet" type="text/css" href="css/owl_carousel/owl.theme.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.transitions.min.css" > <!--Other CSS files--> <link rel="stylesheet" type="text/css" href="css/responsive.css"> <link rel="stylesheet" type="text/css" href="css/main.css"> <link rel="stylesheet" type="text/css" href="css/fa/font-awesome.css"> <!--Jquery--> <script src="js/jquery-2.2.3.min.js"></script> <!-- Bootstrap JS --> <script src="js/boot/bootstrap.js"></script> <!--<script src="js/boot/bootstrap.min.js"></script>--> <!--Other Js files--> <script src="js/main.js"></script> <script src="js/owl/owl.carousel.js"></script>
我以前做了很多次,但这次似乎无法让它工作.任何人都知道我做错了什么?
我被要求添加我在页面上使用的第二个旋转木马,下面是所述旋转木马的html / js
<div id="owl" class="owl-carousel owl-theme"> <div class="item first-item"> <div class="products-images"> <a href="./img/catalog/9-Assortments-Storage.pdf" target="_blank">Assortments</a> </div> </div> <div class="item"> <div class="products-images"> <a href="./img/catalog/4-Tools.pdf" target="_blank">Tools</a> </div> </div> <div class="item"> <div class="products-images"> <a href="./img/catalog/4-Tools.pdf" target="_blank">Cutting Tools</a> </div> </div> <div class="item active"> <div class="products-images "> <a href="./img/catalog/7-Brass.pdf" target="_blank">Fittings</a> </div> </div> <div class="item"> <div class="products-images"> <a href="./img/catalog/6-Electrical.pdf" target="_blank">Electrical</a> </div> </div> <div class="item"> <div class="products-images"> <a href="./img/catalog/1-Fasteners.pdf" target="_blank">Fasteners</a> </div> </div> <div class="item"> <div class="products-images"> <a href="./img/catalog/2014Safety.pdf" target="_blank">Saftey</a> </div> </div> <div class="item"> <div class="products-images"> <a href="./img/catalog/5-ShopSupplies.pdf" target="_blank">Shop Supplies</a> </div> </div> <div class="item"> <div class="products-images"> <a href="./img/catalog/2-Rivets-Huck.pdf" target="_blank">Rivets</a> </div> </div> <div class="item"> <div class="products-images"> <a href="./img/catalog/2014CustomPackaging.pdf" target="_blank">Custom Packaging</a> </div> </div> <div class="item"> <div class="products-images"> <a href="./img/catalog/3-Chemicals.pdf" target="_blank">Chemicals</a> </div> </div> </div> <script type="text/javascript"> jQuery(document).ready(function(){ jQuery('#owl').owlCarousel({ navigation: true,items: 7,1000:{ items:5 } } }); }); </script>
解决方法
解决了
所以问题似乎是我的owl.carousel.min.js文件和我的css文件,我在开始时下载了最新版本.但是在使用此链接时
<script src="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.0.0-beta.3/owl.carousel.min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.0.0-beta.3/assets/owl.carousel.min.css"> <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.0.0-beta.3/assets/owl.theme.default.min.css">
它开始工作了.不确定我下载的文件是否已损坏,但无论如何.它现在正在工作.希望这有助于将来的人!