猫头鹰轮播autoplayTimeout不起作用

问题描述

我的猫头鹰轮播中有以下设置

$(".slider").owlCarousel({
        items: 1,loop: true,nav: true,margin: 0,dots: true,// animateIn: 'fadeIn',// animateOut: 'fadeOut',autoplay: true,lazyLoad: true,smartSpeed: 1000,autoplayTimeout: 7000
        //autoplaySpeed: true,});

我认为是正确的,但是autoplayTimeout无法正常工作。为什么?猫头鹰传送带2,ver。 2.3.4。

解决方法

就像我告诉你的一样工作正常,这里有一个设置示例:

var owl = $('.owl-carousel');
owl.owlCarousel({
    items: 1,loop: true,nav: true,margin: 0,dots: true,// animateIn: 'fadeIn',// animateOut: 'fadeOut',autoplay: true,lazyLoad: true,smartSpeed: 1000,autoplayTimeout: 7000
        //autoplaySpeed: true,});
.item1
{
height:200px;
background-color:red;
}
.item2
{
height:200px;
background-color:blue;
}
.item3
{
height:200px;
background-color:magenta;
}
.item4
{
height:200px;
background-color:green;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js"></script>

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.carousel.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.theme.default.css">

<div class="owl-carousel owl-theme">
            <div class="item1">
              <h4>1</h4>
            </div>
            <div class="item2">
              <h4>2</h4>
            </div>
            <div class="item3">
              <h4>3</h4>
            </div>
            <div class="item4">
              <h4>4</h4>
            </div>
            
          </div>