猫头鹰传送带2失去焦点时会停止自动播放的工作 [英] Owl-carousel 2 stop the work of autoplay when lose a focus
问题描述
我使用Owl-carousel2.我使用Owl-carousel 2的初始化和标记的标准代码.在页面的第一个负载下,carousel的工作非常完美.当我将浏览器传递到另一个页面并返回或最小化浏览器并再次使用Owl-carousel 2打开页面时,Owl-carousel 2停止工作.再次单击导航时,Owl-carousel 2重新开始.我曾尝试再次放置在轮播初始化的html代码正文中:
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-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. I had try to place in body of html code of initialization of carousel again:
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
推荐答案
我知道这个问题已经很老了,但是由于还没有答案,并且问题仍然存在于Owl Carousel 2.2.1
中,因此,这是一个简单的解决方案,可能希望可以帮助某人:
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的Beta版本,您可以在此处.只需抓住
owl.carousel.js
或owl.carousel.min.js
文件,并用它替换当前正在使用的文件即可.在 在撰写本文时,当前的beta版本是2.3.0.我可以 确认此版本可以为我解决问题.
Try using the beta build of Owl Carousel, you can get it here. Just grab the
owl.carousel.js
orowl.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.
问题是已知错误.问题跟踪器中的讨论可以更深入地了解导致问题的原因,因此,如果您不想使用beta版本,则可以使用它来修改现有的owl.carousel.js
以合并您自己的修复程序.
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.
这篇关于猫头鹰传送带2失去焦点时会停止自动播放的工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!