gpt4 book ai didi

javascript - Owl-carousel 2 在失去焦点时停止自动播放的工作

转载 作者:行者123 更新时间:2023-11-28 02:48:50 25 4
gpt4 key购买 nike

我使用 Owl-carousel 2。我使用 Owl-carousel 2 的标准初始化代码和标记。在第一次加载页面时,carousel 的工作是完美的。当我在浏览器中传递到另一个页面并返回或最小化浏览器并再次使用 Owl-carousel 2 打开页面时,Owl-carousel 2 停止工作。当我再次单击导航时,轮播的新开始。我曾尝试再次将 carousel 初始化的 html 代码放在主体中:

var $carousel = $('.owl-carousel');
var owl = $carousel.data('owlCarousel');
owl.trigger("refresh.owl.carousel");

但它不起作用。自动播放需要运行,但它不工作。我该如何纠正这个问题?谢谢

最佳答案

我知道这个问题很老了,但是因为它还没有答案,而且这个问题仍然存在于 Owl Carousel 2.2.1 中,这里有一个简单的解决方案,希望对某人有所帮助:

Try using the beta build of Owl Carousel, you can get it here. Just grab the owl.carousel.js or owl.carousel.min.js file and replace the one you're using currently with it. At the moment of this writing the current beta build is 2.3.0. I can confirm that this build fixed the issue for me.


问题是 known bug .问题跟踪器中的讨论提供了更多关于导致它的原因的见解,因此如果您不想使用测试版,您可以使用它来修改现有的 owl.carousel.js 以合并您自己的修复程序.

关于javascript - Owl-carousel 2 在失去焦点时停止自动播放的工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40316834/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com