Blueprint-FixedBackgroundScrollingLayout icon indicating copy to clipboard operation
Blueprint-FixedBackgroundScrollingLayout copied to clipboard

Add Autoplay

Open mpmp0 opened this issue 12 years ago • 0 comments

Feature Request: Option for autoplay the slider at a set interval, like 5 seconds.

$(window).load(function(){

    cpb_currentSlider = $('.cbp-fbcurrent').attr('href');
    var cpb_lastChar = cpb_currentSlider.substr(cpb_currentSlider.length - 1);

    function cpb_getCurrentSlider() {
        cpb_currentSlider = $('.cbp-fbcurrent').attr('href');
    }

    function cpb_getLastChar() {
        cpb_lastChar = cpb_currentSlider.substr(cpb_currentSlider.length - 1);
    }

    setInterval(function() {

        cpb_getCurrentSlider();
        cpb_getLastChar();
        cpb_nextChar = cpb_lastChar++;
        cpb_nextSlider = "#fbsection" + cpb_lastChar;

        if (cpb_nextSlider == '#fbsection6') {
            cpb_nextSlider = '#fbsection1';
        }

        $('a[href$='+cpb_nextSlider+']').trigger("click");

    }, 5000);

});

mpmp0 avatar Jul 18 '13 05:07 mpmp0