Coder Social home page Coder Social logo

Comments (5)

grandsyntax avatar grandsyntax commented on August 15, 2024

Essentially what I want to accomplish is to start the loop at the active slide specified.

Thx

from swiper.

grandsyntax avatar grandsyntax commented on August 15, 2024

Fixed. It turns out the index wasn't type cast correctly further up the chain. I recommend type casting inside the swipeTo method to catch this.

_this.swipeTo = function (index, speed, runCallbacks) {

    index = parseInt(index, 10); //type cast to int
    if (index > (numOfSlides-1)) return;
    if (index<0 && !params.loop) return;

from swiper.

grandsyntax avatar grandsyntax commented on August 15, 2024

Also I had to wrap in setTimeout to prevent the loop setTimeout from executing later in the cycle.

//Adding identical setTimeout in my method call to keep in sync with the in loop conditional. Otherwise it will call before the loops version.

setTimeout(function(){
    imageSwiper.swipeTo(active,0);
}, 0);

from swiper.

nolimits4web avatar nolimits4web commented on August 15, 2024

Yeah, had the same issue on project I am working and also wrap with setTimeout helped. Will think how to remove this timeout from script to make it work without it

from swiper.

nolimits4web avatar nolimits4web commented on August 15, 2024

Fixed in 1.6. Now can be used without setTimeout

from swiper.

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.