Reputation: 11
I am currently using swipe 2.0 js using the following call which takes the last image back to the first continuously.
<script>
window.mySwipe = new Swipe(document.getElementById('mySwipe'), {
startSlide: 0,
speed: 400,
auto: 3000,
continuous: true,
disableScroll: false,
stopPropagation: false,
callback: function(index, elem) {},
transitionEnd: function(index, elem) {}
});
</script>
However, my client doesn't like the way this works and wants it slide back to the start in the same direction, or to slide back showing the other images as it goes.
Any know if this is possible?
Upvotes: 1
Views: 2024
Reputation: 29991
To go back to the first image you could use the slide()
method:
$(document).ready(function() {
window.mySwipe = new Swipe(document.getElementById('mySwipe'), {
speed: 400,
auto: 3000,
continuous: false,
transitionEnd: function(index, elem) {
// when a transition ends we check if we have reached the last image
if(index == window.mySwipe.getNumSlides()-1) {
// if its the last image we rewind to the first one
window.mySwipe.slide(0, 1000);
}
}
});
});
Upvotes: 2