代码之家  ›  专栏  ›  技术社区  ›  Jonny Haynes

jquery anythingslider-使第一张幻灯片持续两倍的长度

  •  0
  • Jonny Haynes  · 技术社区  · 16 年前

    我正在使用 anythingSlider 作者:Chris Coyier。

    基本上,它使列表项在指定时间后从左侧滑入。

    我想修改代码,这样第一个 <li> 可见时间是其他的两倍。

    例如,如果幻灯片在7秒内可见,则第一张幻灯片需要在14秒内可见。

    有什么想法吗?

    3 回复  |  直到 16 年前
        1
  •  3
  •   jitter    16 年前

    应该很容易

    var timeVisible = 7000;
    $('.anythingSlider').anythingSlider({
        autoPlay: true,
        startStopped: true,
        delay: timeVisible ,
        ...
    });
    
    setTimeout(function() {
        $("div.anythingSlider a#start-stop").trigger("click");
    }, timeVisible);
    
        2
  •  0
  •   RamboNo5    16 年前

    你可以改变 startStop 此功能(注意 var extraTime ):

            // Handles stopping and playing the slideshow
        // Pass startStop(false) to stop and startStop(true) to play
        base.startStop = function(playing){
            if(playing !== true) playing = false; // Default if not supplied is false
    
            // Update variable
            base.playing = playing;
    
            // Toggle playing and text
            if(base.options.autoPlay) base.$startStop.toggleClass("playing", playing).html( playing ? base.options.stopText : base.options.startText );
    
            var extraTime = 0;
            if(base.currentPage == 1){
                extraTime = base.options.delay;
            }
    
            if(playing){
                base.clearTimer(); // Just in case this was triggered twice in a row
                base.timer = window.setInterval(function(){
                    base.goForward(true);
                }, base.options.delay + extraTime);
            } else {
                base.clearTimer();
            };
        };
    

    在第223行 jquery.anythingslider.js .

        3
  •  0
  •   HOSOIToshiya    16 年前

    任何一件事里德尔似乎都不适合歌剧10.10(至少对我来说)。

    .anythingslider.wrapper ul width:99999px; ---gt; .anythingslider.wrapper ul width:9999px;