Jquery、Jcarousel 平滑无限滚动

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2442588/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 13:31:45  来源:igfitidea点击:

Jquery, Jcarousel smooth infinite scrolling

jqueryjcarousel

提问by

I am using jcarousel to auto scroll some images. I would like to know how to make them scroll in one fluid scroll with no pauses or stops.

我正在使用 jcarousel 自动滚动一些图像。我想知道如何让它们在一个流畅的卷轴中滚动而没有停顿或停止。

Currently there is a pause and then it scrolls again. If I am not making myself clear then ask and I will try to explain a little better.

目前有一个暂停,然后它再次滚动。如果我没有说清楚,那就问吧,我会试着解释得更好一点。

This is the code:

这是代码:

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        auto: 1,
        wrap: 'last',
        vertical: true,
        animation: 5000

    });

采纳答案by carillonator

try

尝试

auto: .01

you have it set to autoscroll every 1 second. I don't think a fluid scroll is possible, but this should look just about the same.

您将其设置为每 1 秒自动滚动一次。我认为流体滚动是不可能的,但这应该看起来差不多。

回答by Jake

This questions is as old as dirt, but I figured I give the updated solution.

这个问题和污垢一样古老,但我想我给出了更新的解决方案。

$('.jcarousel').jcarousel({
    wrap: 'circular',
    animation: {
        duration: 3000,
        easing:   'linear',
    }
  });
  $('.jcarousel').jcarouselAutoscroll({
      interval: 0
  });

回答by Mushex Antaranian

To me it scrolls "smoother" when used linear easing instead of swing.

对我来说,当使用线性缓动而不是摆动时,它会滚动“更平滑”。

auto:   .01,
easing: 'linear'

回答by Code Spy

Here is another scroller with many features like speed control auto infinite scroll and having mouse events would be helpful. I found it after a deep goggling. http://bloggerplugnplay.blogspot.com/2011/07/horizontal-auto-image-strip.html

这是另一个具有许多功能的滚动器,例如速度控制自动无限滚动和鼠标事件会有所帮助。我在深入观察后找到了它。http://bloggerplugnplay.blogspot.com/2011/07/horizo​​ntal-auto-image-strip.html

回答by Binu Joseph

  • Open jquery.jcarousel.min.js
  • Beautify the script using http://jsbeautifier.org
  • find and replace "this.options.auto * 1E3" with "0" (zero)
  • 打开 jquery.jcarousel.min.js
  • 使用http://jsbeautifier.org美化脚本
  • 找到并用“0”(零)替换“this.options.auto * 1E3”

Something like:

就像是:

function mycarousel_initCallback(carousel){   
    // Pause autoscrolling if the user moves with the cursor over the clip.

    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

jQuery(document).ready(function() {

    jQuery('#mycarousel').jcarousel({
        auto:   1,
        animation:2000,
        easing: 'linear',
        wrap: 'circular',
        scroll:1,
        buttonNextHTML: null,
        buttonPrevHTML: null,
        initCallback: mycarousel_initCallback
    });
});

thats all. :)

就这样。:)