猫头鹰旋转木马没有显示图像

时间:2018-05-08 09:45:37

标签: jquery twitter-bootstrap owl-carousel

我试图在我的项目中添加照片轮播,但猫头鹰旋转木马不能显示我的图像(src绝对正确),它显示整个容器底部带有导航点和prev /下一个按钮,但不是我的图像。

非常感谢任何帮助!

html:

 <head> 
 <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
 <link href="plugins/owl-carousel/assets/owl.carousel.min.css" rel="stylesheet">
 <link href="plugins/owl-carousel/assets/owl.theme.default.min.css" rel="stylesheet">
  </head>
  <body>
  <div class="container">
  <div class="owl-carousel owl-theme">
    <div class="owl-item">
        <img  src="images/1.jpg">
    </div>
    <div class="owl-item">
        <img  src="images/9.jpg">
    </div>
    <div class="owl-item">
        <img  src="images/10.jpg">
    </div>
    <div class="owl-item">
        <img  src="images/11.jpg">
       </div>
      </div>
    </div>

    <script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.js"></script>
    <script src="plugins//owl-carousel/owl.carousel.min.js"></script>

    <script type="text/javascript">
    $('.owl-carousel').owlCarousel({
        loop:true,
        margin:10,
        nav:true,
        autoPlay: 1000,
        responsive:{
            0:{
                items:1
            },
            600:{
                items:3
            },
            1000:{
                items:5
            }
        }
    });
    </script>
    </body>

4 个答案:

答案 0 :(得分:0)

你在脚本路径中使用了double / 用这个改变它

<script src="plugins/owl-carousel/owl.carousel.min.js"></script>

答案 1 :(得分:0)

你可以试试下面的代码

&#13;
&#13;
$('.owl-carousel').owlCarousel({
        loop:true,
        margin:10,
        nav:true,
        autoPlay: 1000,
         items:10,
        responsive:{
            0:{
                items:1
            },
            600:{
                items:3
            },
            1000:{
                items:10
            }
        }
    });
&#13;
<link rel="stylesheet" href="https://owlcarousel2.github.io/OwlCarousel2/assets/owlcarousel/assets/owl.carousel.min.css" media="screen"> 

<div class="container">
  <div class="owl-carousel owl-theme">
    <div class="item">
        <img  src="https://images.pexels.com/photos/248797/pexels-photo-248797.jpeg?auto=compress&cs=tinysrgb&h=350">
    </div>
     <div class="item">
        <img  src="https://images.pexels.com/photos/248797/pexels-photo-248797.jpeg?auto=compress&cs=tinysrgb&h=350">
    </div>
     <div class="item">
        <img  src="https://images.pexels.com/photos/248797/pexels-photo-248797.jpeg?auto=compress&cs=tinysrgb&h=350">
    </div>
     <div class="item">
        <img  src="https://images.pexels.com/photos/248797/pexels-photo-248797.jpeg?auto=compress&cs=tinysrgb&h=350">
    </div>
     <div class="item">
        <img  src="https://images.pexels.com/photos/248797/pexels-photo-248797.jpeg?auto=compress&cs=tinysrgb&h=350">
    </div>
     <div class="item">
        <img  src="https://images.pexels.com/photos/248797/pexels-photo-248797.jpeg?auto=compress&cs=tinysrgb&h=350">
    </div>
     <div class="item">
        <img  src="https://images.pexels.com/photos/248797/pexels-photo-248797.jpeg?auto=compress&cs=tinysrgb&h=350">
    </div>
     <div class="item">
        <img  src="https://images.pexels.com/photos/248797/pexels-photo-248797.jpeg?auto=compress&cs=tinysrgb&h=350">
    </div>
     <div class="item">
        <img  src="https://images.pexels.com/photos/248797/pexels-photo-248797.jpeg?auto=compress&cs=tinysrgb&h=350">
    </div>
  <div class="item">
        <img  src="https://images.pexels.com/photos/248797/pexels-photo-248797.jpeg?auto=compress&cs=tinysrgb&h=350">
    </div>
    <div class="item">
        <img  src="https://images.pexels.com/photos/248797/pexels-photo-248797.jpeg?auto=compress&cs=tinysrgb&h=350">
    </div>
    <div class="item">
        <img  src="https://images.pexels.com/photos/248797/pexels-photo-248797.jpeg?auto=compress&cs=tinysrgb&h=350">
    </div>
    <div class="item">
        <img  src="https://images.pexels.com/photos/248797/pexels-photo-248797.jpeg?auto=compress&cs=tinysrgb&h=350">
    </div>
    </div>

<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://owlcarousel2.github.io/OwlCarousel2/assets/owlcarousel/owl.carousel.js"></script>
&#13;
&#13;
&#13;

答案 2 :(得分:0)

请将类owl-item更改为除owl carousel default关键字之外的其他名称,因为它会发生冲突。的 see

答案 3 :(得分:0)

我已经弄清楚了我的问题。 显然,Owl Carousel的页面设置为rtl会出现问题。

为了解决我的问题,我所要做的只是将rtl:true添加到jquery函数。

感谢所有帮助者!