Swiper: slideTo realIndex

Created on 10 Feb 2018  路  5Comments  路  Source: nolimits4web/swiper

This is a (multiple allowed):

  • [x] bug
  • [ ] enhancement
  • [ ] feature-discussion (RFC)

https://jsfiddle.net/5z4x9jt5/

What you did

Trying to figure out intended method to "slideTo" a specific slide index with loop: true

Expected Behavior

There should be a reasonable way to "slideTo" a slide index whose swiper has loop: true

Actual Behavior

Difficult to slideTo a specific slideTo without inspecting the DOM to know how many slides were added as a result of loop: true. Alternatively, I guess you could force loopAdditionalSlides to a defined number, but that should not be a requirement to be able to use slideTo with realIndex

All 5 comments

I realize there was previously #2135 filed, but I really hope you reconsider this issue, as it should not require specific setup just to be able to do something as basic as "slideTo" a slide

Awesome. Would it be best to just build this into the slideTo method using if swiped.loop === true so as to not pollute with additional methods?
Thanks

No, because it will be impossible to slide by actual index

Any updates on this? slideToLoop is not working in version 4.3.3. :(
Is it possible somehow to use slideTo in combination with loop: true?
Thanks!

@nolimits4web Ok, so you wrote this in #2135 :

In loop mode there are duplicated HTML elements of slides. You need to consider it when doing slideTo with enabled loop mode

Which is a complete degeneracy. When I call Swiper.slideTo(2), I do not need to consider anything, I expect the component to show me 2nd slide. All the internal workings of the component, such as cloning and CSS transforms etc. should never be my concern. Check bxSlider, for example, they are also using cloned elements for infinite loop and bxSlider.goToSlide() works properly, as it should. Your idea that I should consider cloned elements is just plain stupid.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kokujin picture kokujin  路  22Comments

calidion picture calidion  路  17Comments

edwardjosephbennett picture edwardjosephbennett  路  21Comments

ertdfgcvb picture ertdfgcvb  路  25Comments

loriepisicchio picture loriepisicchio  路  27Comments