Git Product home page Git Product logo

Comments (5)

arielsalminen avatar arielsalminen commented on September 28, 2024 1

Hello @neoanchorite .

I made a custom autoCycle code for you, which allows that. Just replace the whole “startCycle” function with this new one below. I also commented the code so it’s easier to understand what each line does.

It has an option called “numberOfCycles” on top where you can specify how many cycles you want to see.

startCycle = function () {

  // Set how many cycles you want to see
  var numberOfCycles = 2;

  // Helpers to determine how many cycles we've had
  // and which slide is the last one.
  var countCycles = 0,
    lastSlide = $slide.length - 1;

  rotate = setInterval(function () {

    // Clear the event queue
    $slide.stop(true, true);

    // Determines where to slide next
    var idx = index + 1 < length ? index + 1 : 0;

    // Remove the active state and set a new one if option “pager” is true
    if (settings.pager) {
      selectTab(idx);
    }

    // Slide to the next slide
    slideTo(idx);

    // Check if we are seeing the last slide
    if (idx === lastSlide) {
      // If we are, then increase the count number
      countCycles++;
    }

    // Stop after X amount of cycles
    if (countCycles === numberOfCycles) {
      clearInterval(rotate);
    }

  }, waitTime);
};

from responsiveslides.js.

neoanchorite avatar neoanchorite commented on September 28, 2024

Wow! That works a treat. I want to make a donation, but I can't find a button. Do you have one somewhere?

from responsiveslides.js.

mojodaddy avatar mojodaddy commented on September 28, 2024

Dear viljamis -- Working with v1.54 and can't seem to implement this fix from 2012. I'm just looking to stop the loop at th end of one cycle. Can you assist?

The files I have in place are responsiveslides-call.js, responsiveslides.js and responsiveslides.min.js

Thanks for any help!

from responsiveslides.js.

Olfried2 avatar Olfried2 commented on September 28, 2024

Hi Viljamis, same problem as mojodaddy but with v1.55. Just want to cycle 1or 2 time(s).
Couldn't you just add it to the actual code?
Thanks in advance.

from responsiveslides.js.

sandusky avatar sandusky commented on September 28, 2024

I used the above snippet, then modified it slightly to have my slideshow end by cycling back to the first slides, so I have a full rotation plus 1. Thanks for the update!

from responsiveslides.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.