[HomepageSlider] Homepageslider autoplay

[HomepageSlider] Homepageslider autoplay

  
Forge Component
(0)
Published on 2015-06-19 by Viegas
0 votes
Published on 2015-06-19 by Viegas
Hello,

Just implented this slider and one feature that I would like to have is autoplay.
Been looking at the code but don't know how to implement this feature, does anyone have any ideas or implented this already?

I'm in platform 9.0.1.60
greetings
One simple thing you can do is to have a javascript click with a given delay, something like this:
var secondClick = false;
var duration = 1000;

$('#someElement').on('click', 'a', function(event) {
    var that = $(this);

    if(!secondClick) {
        event.stopPropagation();
        setTimeout(function(){
            secondClick = true;
            that.click();
        }, duration);

        someAsynchronousFunction();
    } else {
        secondClick = false;
    }
}
Or something like this (with the setTimeout function):

$('#someElement').click(function(event){
    event.preventDefault();
    var loc = $(this).attr('href');
    $.ajax({
        url: "test.html",
        complete: function(){
            // Handle the complete event
            loc = $(this).attr('href');
            window.location.href = loc;
        }
    });
});