猫头鹰旋转木马2开始自动播放时,部分可见
owl carousel 2 start autoplay when the section visible
我正在做一个项目,我想启动猫头鹰旋转木马2的自动运行功能,当我将在那个旋转木马部分。正常情况下,自动播放不会运行,当我向下滚动并悬停在部分上时,自动播放将开始。参见代码——
HTML:<div class="header">
<h1>this is heading section</h1>
</div>
<div class="section">
<h1>This is section</h1>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries</p>
<div class="owl-carousel">
<div><img src="http://placehold.it/550x450"/></div>
<div><img src="http://placehold.it/550x450"/></div>
<div><img src="http://placehold.it/550x450"/></div>
<div><img src="http://placehold.it/550x450"/></div>
<div><img src="http://placehold.it/550x450"/></div>
<div><img src="http://placehold.it/550x450"/></div>
<div><img src="http://placehold.it/550x450"/></div>
<div><img src="http://placehold.it/550x450"/></div>
<div><img src="http://placehold.it/550x450"/></div>
</div>
</div>
JS:
var owl = $('.owl-carousel');
owl.owlCarousel({
items: 1,
center: false,
loop: true,
autoplay: false,
autoplayTimeout: 1000,
smartSpeed:1000,
autoplayHoverPause: true
});
$('.section').mouseover(function(e) {
owl.trigger('play.owl.autoplay', [1000]);
})
看我使用鼠标悬停功能来激活功能,我的意思是当我鼠标悬停在部分的自动播放需要运行,但它不工作…请帮帮我……
JSFIDDLE DEMO PROJECT HERE
那么,您需要以下内容:
var owl = $('.owl-carousel');
owl.owlCarousel({
items: 1,
loop: true
});
$('.section').on("mouseenter", function(e) {
owl.trigger('owl.play', 1000);
//Not owl.trigger('play.owl.autoplay', [1000]);
})
演示-
请查看文档,因为您使用的要么是旧版本,要么是使用了不存在的参数。
相关文章:
- 知道为什么我的旋转木马不会自动更改图片吗
- 禁用旋转木马中的下一个按钮和上一个按钮
- 旋转木马;启用内容安全策略时无法工作
- 在引导程序旋转木马中显示下一个图像
- 猫头鹰旋转木马2罐头't使渐变动画工作
- 猫头鹰旋转木马宽度计算错误
- 猫头鹰旋转木马动画未在Chrome中应用
- 猫头鹰旋转木马:无法读取属性'visibleItems'的未定义
- 在Javascript中设置多个小图像(如旋转木马)
- 如何使引导旋转木马保持图像纵横比
- 使用旋转木马在元素上切换类
- 将图像传递到Angular UI引导旋转木马
- 当ons惰性重复检测到更改时,如何使用ons旋转木马刷新列表
- 猫头鹰旋转木马2-拖动方向
- 带有JQuery和CSS的3D旋转木马-渲染不正确
- 从引导程序旋转木马中的特定幻灯片开始
- Hammer.js旋转木马开始窗格
- 如何在页面加载的第一个项目之后开始旋转木马
- 从头开始制作jquery旋转木马
- 猫头鹰旋转木马2开始自动播放时,部分可见