简体   繁体   English

猫头鹰传送带2失去焦点时会停止自动播放的工作

[英]Owl-carousel 2 stop the work of autoplay when lose a focus

I use Owl-carousel 2. I use standard code of initialization and markup of Owl-carousel 2. At the first load of page the work of carousel is perfect. 我使用Owl-carousel2。我使用Owl-carousel 2的初始化和标记的标准代码。在页面的第一个负载下,carousel的工作是完美的。 Owl-carousel 2 stop the work when I pass in browser to another page and back or minimize browser and again open page with Owl-carousel 2. New start of carousel when I again click navigation. 当我在浏览器中传递到另一个页面并返回或最小化浏览器并再次使用Owl-carousel 2打开页面时,Owl-carousel 2停止工作。再次单击导航时,Owl-carousel 2重新开始。 I had try to place in body of html code of initialization of carousel again: 我曾尝试再次放置在轮播初始化的html代码正文中:

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

But it is not working. 但这是行不通的。 Autoplay need to run but it is not working. 自动播放需要运行,但无法正常工作。 How I can correct this problem? 我该如何解决这个问题? Thanks 谢谢

I know this question is rather old, but since it has no answer yet, and the issue is still present in Owl Carousel 2.2.1 , here's a simple solution that may hopefully help someone: 我知道这个问题已经很老了,但是由于它还没有答案,而且问题仍然存在于Owl Carousel 2.2.1 ,因此有一个简单的解决方案可以对某人有所帮助:

Try using the beta build of Owl Carousel, you can get it here . 尝试使用Owl Carousel的beta版本,您可以在此处获得。 Just grab the owl.carousel.js or owl.carousel.min.js file and replace the one you're using currently with it. 只需获取owl.carousel.jsowl.carousel.min.js文件,并用它替换当前正在使用的文件即可。 At the moment of this writing the current beta build is 2.3.0. 在撰写本文时,当前的beta版本是2.3.0。 I can confirm that this build fixed the issue for me. 我可以确认此版本为我解决了该问题。


The issue is a known bug . 问题是一个已知的错误 The discussion in the issue tracker provides more insight into what causes it, so you could use it to modify your existing owl.carousel.js to incorporate your own fix if you don't feel like using beta builds. 问题跟踪器中的讨论可以更深入地了解导致问题的原因,因此,如果您不想使用beta版本,则可以使用它来修改现有的owl.carousel.js以合并您自己的修复程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM