Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 鼓膜弹性旋转木马自动播放_Jquery - Fatal编程技术网

Jquery 鼓膜弹性旋转木马自动播放

Jquery 鼓膜弹性旋转木马自动播放,jquery,Jquery,我正在为我的网站使用tympanus Elastislide旋转木马响应jQuery插件。这个插件在我的网站上运行得非常好。但是,我希望casousel能自动播放 但是,我没有找到任何自动移动转盘的代码 滑块插件链接: 我正在使用的java脚本 <script type="text/javascript"> $( '#carousel' ).elastislide( { // orientation 'horizontal' || 'vertical' o

我正在为我的网站使用tympanus Elastislide旋转木马响应jQuery插件。这个插件在我的网站上运行得非常好。但是,我希望casousel能自动播放

但是,我没有找到任何自动移动转盘的代码

滑块插件链接:

我正在使用的java脚本

<script type="text/javascript">

    $( '#carousel' ).elastislide( {

    // orientation 'horizontal' || 'vertical'
    orientation : 'horizontal',

    // sliding speed
    speed : 500,

    // sliding easing
    easing : 'ease-in-out',

    // the minimum number of items to show.
    // when we resize the window, this will make sure minItems are always shown
    // (unless of course minItems is higher than the total number of elements)
    minItems : 3,

    // index of the current item (left most item of the carousel)
    start : 0,

    // click item callback
    onClick : function( el, position, evt ) { return false; },
    onReady : function() { return true; },
    onBeforeSlide : function() { return false; },
    onAfterSlide : function() { return false; }

    } );            

</script>

$(“#旋转木马”).elastislide({
//方向“水平”| |“垂直”
方向:“水平”,
//滑动速度
速度:500,,
//滑动缓和
放松:“放松进入”,
//要显示的最小项目数。
//当我们调整窗口大小时,这将确保始终显示最小项
//(当然,除非最小项高于元素总数)
最小项:3,
//当前项目的索引(旋转木马最左侧的项目)
起点:0,
//单击项目回调
onClick:function(el,position,evt){return false;},
onReady:function(){return true;},
onBeforeSiled:function(){return false;},
onAfterSlide:function(){return false;}
} );            

任何人都可以帮助滑块如何自动播放?我试过自动播放:真的。但是,不起作用

尝试滚动属性

scroll: 1

你可以在这里找到答案,所有类型的转盘滑块都给出了

也看看这些


下面是一个类似问题的修改答案:

这将使Elastislide自动播放,当在最后一张幻灯片上时,它将返回到第一张幻灯片

将此代码添加到
$.Elastislide.defaults
对象的
开始:0,

// autoplay true || false
autoplay : true,
然后,您将能够在设置选项时设置
autoplay
值(true或false),就像您在上面的示例代码中尝试的那样

此代码应添加到var
self=This之后的
\u initEvents
函数中

     if(this.options.autoplay == true){
            var translation = 0;
            // width/height of an item ( <li> )
            var itemSpace = this.options.orientation === 'horizontal' ? this.$items.outerWidth( true ) : this.$items.outerHeight( true );
            // total width/height of the <ul>
            var totalSpace = this.itemsCount * itemSpace;
            // visible width/height
            var visibleSpace = this.options.orientation === 'horizontal' ? this.$carousel.width() : this.$carousel.height();
            //slide auto
            window.setInterval(function(){
                //test if we should go to next slide or return to first slide
                if(totalSpace > translation + visibleSpace)
                {
                    //go to next slide
                    self._slide('next');
                    //update translation
                    translation += visibleSpace;
                }
                else
                {
                    //return to first slide
                    self._slideTo(0);
                    //set translation to 0
                    translation = 0;
                }
            }, 7000);
        }
if(this.options.autoplay==true){
var转换=0;
//项目的宽度/高度(
  • ) var itemSpace=this.options.orientation=='horizontal'?this.$items.outerWidth(true):this.$items.outerHeight(true); //
      var totalSpace=this.itemscont*itemSpace; //可见宽度/高度 var visibleSpace=this.options.orientation==“水平”?this.$carousel.width():this.$carousel.height(); //自动滑动 setInterval(函数(){ //测试我们是否应该转到下一张幻灯片或返回到第一张幻灯片 if(总空间>平移+可视空间) { //转到下一张幻灯片 自我。_幻灯片(“下一步”); //更新翻译 翻译+=可视空间; } 其他的 { //返回到第一张幻灯片 自滑至(0); //将翻译设置为0 翻译=0; } }, 7000); }

  • 请注意,随着Elastislide在1.1.0版之后的发展,此代码在未来版本中可能无法使用。

    有关

    请参见Autoscroll插件:


    请参阅第一个链接,它将提供所有旋转木马类型,请参阅您可以找到所需滑块的演示。您好,滑块js文件中没有自动滚动属性,请尝试其他自动滚动滑块。谢谢。我正在尝试使用其他滑块。OP没有使用或询问jCarousel。您正在谈论的功能在Elastislide.nice中不可用。最佳答案
    $('.jcarousel')
      .jcarousel({
        wrap: 'circular'
      })
      .jcarouselAutoscroll({
        interval: 3000,
        target: '+=1',
        autostart: true
    });