jQuery 如何阻止 Owl carousel 倒带?我只想要一个无缝循环
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26349622/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I stop Owl carousel from rewinding? I just want a seamless loop
提问by DSA Web Specialists
How do I make the Owl carousel from rewinding? I just want a continuous loop. Do I need to write a full callback for something that should already included in the plugin? I tried to use the loop: true; no luck.
如何从倒带制作猫头鹰旋转木马?我只想要一个连续的循环。我是否需要为插件中已经包含的内容编写完整的回调?我尝试使用循环:true; 没运气。
回答by Macsupport
As an example, try this setting
例如,试试这个设置
$("#owl-demo").owlCarousel({
autoPlay: 3000, //Set AutoPlay to 3 seconds
items : 4,
rewindNav:false //**This
});
回答by Raluca Popescu
I came across the same error and found a quick fix for it. You can use rewindSpeed: 0with rewindNav : true.
我遇到了同样的错误,并找到了快速修复方法。您可以将rewindSpeed: 0与rewindNav : true 一起使用。
I tested with these settings:
我使用这些设置进行了测试:
$("#owl-slider-hero").owlCarousel({
autoPlay : 5000,
lazyLoad:true,
navigation : false,
slideSpeed : 500,
paginationSpeed : 400,
singleItem : true,
rewindNav : true,
rewindSpeed: 0
});
By doing so, the script still rewinds, but you can hardly see it. The change is not smooth as in a continuous loop, but it is quite close.
通过这样做,脚本仍会倒带,但您几乎看不到它。这种变化不像连续循环那样平滑,但非常接近。
Hope this helps someone!
希望这可以帮助某人!
回答by user6364254
Before that,set loop to false.Then it will work.
在此之前,将循环设置为 false。然后它会起作用。
$(document).ready(function() {
$('.owl-carousel').owlCarousel({
items:4,
lazyLoad:true,
nav:true,
loop:false,
navRewind:false,
margin:10
});
})