jQueryTools Scrollable - Loops through twice then stops on first slide

340 Views Asked by At

I am trying to figure out a way to go through a set of slides a couple of times and then return and stop on the first slide.

Currently, I have:

$('#con_featured .scrollable').scrollable({
    circular: false
}).navigator({  
    activeClass: 'current',
    navi:'#con_featured .scrollable_nav ul'
}).autoscroll({
    autoplay: true,
    interval: 8000
});

I did find an article on how to scroll back to the beginning of the slider. And I've seen the event "onSeek" that occurs after each item has scrolled. Is there a way to use that (or another event listener) to find when the slides end?

1

There are 1 best solutions below

0
On

A colleague of mine was able to fix the issue by utilizing the Scrollable API. Using the API he was able to get the index of the slider and after it plays through twice, it stops on the first slide.

var loopCounter = 0;
$('#con_featured .scrollable').scrollable({
    onSeek: function() {
        var api = $('#con_featured .scrollable').data("scrollable");

        if(api.getIndex() == 0) {
            loopCounter++;
            if(loopCounter >= 2) api.stop(); // loops twice then stops
        }
    },
    circular: true
}).navigator({  
    activeClass: 'current',
    navi:'#con_featured .scrollable_nav ul'
}).autoscroll({
    autoplay: true,
    interval: 8000
});