开发者

Stop/Start Slider - Stop after one cycle

开发者 https://www.devze.com 2023-03-09 23:05 出处:网络
I have a project that I am working on that uses Start/Stop slider by Chris Coyier shown here http://css-tricks.com/startstop-slider. The client loves it, but now wants it to to just cycle through once

I have a project that I am working on that uses Start/Stop slider by Chris Coyier shown here http://css-tricks.com/startstop-slider. The client loves it, but now wants it to to just cycle through once and stop. Also after it cycles and stops the "Stop" butt开发者_运维技巧on to turn to "Start" so that if the user wants to play it again they can.

I am a newbie at jquery/Javascript and am having no luck figuring this out.

Thank you for your help


You need to update the doMove function and clear the interval after the slide has completed 1 revolution

if (movement == tooFar) {
  $(".slide img").animate({
    "top": -200
  }, function() {
    $("#mover").animate({
      "left": 0
    }, function() {
      $(".slide img").animate({
        "top": 20
      });
    });
  });

  clearInterval(sliderIntervalID);
  $("#slider-stopper").text("Start");
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号