Javascript 全屏狭缝滑块自动播放

Javascript 全屏狭缝滑块自动播放,javascript,jquery,html,jquery-slider,Javascript,Jquery,Html,Jquery Slider,我正在使用这个滑块。一切正常,但自动播放有问题。当我点击滑块上的导航箭头或底部的导航点时。之后,自动播放不起作用 这是链接 自动播放功能不在那里,你必须下载它,并使自动播放:真的在Js Js名称:jquery.slitslider.Js $.Slitslider.defaults = { // transitions speed speed : 800, // if true the item's slices will also animate the opacity

我正在使用这个滑块。一切正常,但自动播放有问题。当我点击滑块上的导航箭头或底部的导航点时。之后,自动播放不起作用

这是链接

自动播放功能不在那里,你必须下载它,并使自动播放:真的在Js

Js名称:jquery.slitslider.Js

$.Slitslider.defaults = {
    // transitions speed
    speed : 800,
    // if true the item's slices will also animate the opacity value
    optOpacity : false,
    // amount (%) to translate both slices - adjust as necessary
    translateFactor : 230,
    // maximum possible angle
    maxAngle : 25,
    // maximum possible scale
    maxScale : 2,
    // slideshow on / off
    autoplay : true,
    // keyboard navigation
    keyboard : true,
    // time between transitions
    interval : 6000,
    // callbacks
    onBeforeChange : function( slide, idx ) {
        return false;
    },
    onAfterChange : function( slide, idx ) {
        return false;
    }
};

因为脚本包含这样的代码,每当你按下函数停止幻灯片放映

switch (keyCode) {

                case arrow.left :

                    self._stopSlideshow(); //this line stops autoplay
                    self._navigate( 'prev' );
                    break;

                case arrow.right :

                    self._stopSlideshow();
                    self._navigate( 'next' );
                    break;

            }

您可以使用内置参数,并在用户交互后再次启动幻灯片放映

$('#slider').slitslider({
    autoplay: true, 
    interval: 6000,
    onAfterChange: function(slide, idx) {
        slitslider._startSlideshow(); // Starts the autoplay again
        return false;
    }
}),

在jquery.slitslider.js中找到这段代码,并将2个false选项更改为true,然后将
\u startSlideshow()
函数添加到它的底部

_stopSlideshow: function() {
        if ( this.options.autoplay ) {

            clearTimeout( this.slideshow );
            this.isPlaying = true; // set this to true
            this.options.autoplay = true; // set this to true
            this._startSlideshow(); // Add this line

        }

    }

无需多做,只需将自动播放选项设置为真即可 自动播放:错误

///


`

那么,即使在点击这些箭头或导航点后,我该怎么做才能保持它的变化呢?我做了,但情况仍然是一样的,自动播放不起作用。坦克人:)完成了。我搜索类似于(_stopSlideshow();)的morel链接并对其进行了评论。现在开始工作了:)谢谢alot@vivek很高兴帮助您
:-)
嗨,当我单击主链接并再次返回滑块页面时,我又遇到了一个问题。。滑块不工作。这是试验场。
    $.Slitslider.defaults = {
    // transitions speed
    speed : 800,
    // if true the item's slices will also animate the opacity value
    optOpacity : false,
    // amount (%) to translate both slices - adjust as necessary
    translateFactor : 230,
    // maximum possible angle
    maxAngle : 25,
    // maximum possible scale
    maxScale : 2,
    // slideshow on / off
    autoplay : true,
    // keyboard navigation
    keyboard : true,
    // time between transitions
    interval : 4000,
    // callbacks
    onBeforeChange : function( slide, idx ) { return false; },
    onAfterChange : function( slide, idx ) { return false; }
};