-
Notifications
You must be signed in to change notification settings - Fork 387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
just 2 sp-slide will break infinite loop. #5
Comments
That's expected behavior when you have only two slides because the slides are arranged in the correct order before the transition begins, so the current slide is taken from its current position and re-positioned in order to maintain an infinite loop. I will see if I can create an exception for cases when only two slides are present. |
I've been thinking about this and my conclusion is that when only two slides are used (which is a rare exception, since a slider is usually used for more slides) loop should be set to false, and this would solve the blank space issue. The reason for this is that even if I eliminate the blank space when a new slide is called, there's still a problem with the touch-swipe function. Imagine that there are 2 slides and you're on the first slide. If you swipe the slider to the right in order to reveal slides from the left, there's still blank space because slide 2 is at the right of slide 1 and there aren't slides at the left. The only way to fix this is by detecting the direction of the swipe and re-position the slides immediately after the swipe starts, but this could be a hit on performance because of all the operations that need to be done at the same time with the animations. In my opinion the downsides are not worth having just for handling a rare case, which, like I said, can work fine if loop is set to false. |
I've tested slider-pro example1.html.
Set with loop:true or let it default setting and coded just 2 sp-slide, blank part will come with each slide.
The text was updated successfully, but these errors were encountered: