﻿jQuery(document).ready(function () {
    //var scr
    //scr = $("#scroll").scrollable({ circular: true, easing: 'custom',speed:700,interval:10000 }).autoscroll({ autoplay: true });

    var div = $("div#scroll");
    var delais = 4000;
    var timer;
    var scr = div.scrollable({
        api: true,
        size: 2,
        easing: 'custom', 
        interval: 0,  
        circular: true,  
        speed: 700, 

        onSeek: function () {
            this.getItems().fadeTo(300, 1); 
            clearTimeout(timer);
            timer = setTimeout(function () { scr.next(); }, delais);
        }
    });
    timer = setTimeout(function () { scr.next(); }, delais);
    div.mouseenter(function () {
        clearTimeout(timer);
    });
    div.mouseleave(function () {
        timer = setTimeout(function () { scr.next(); }, delais);
    });

    $("#prev").click(function () {
        scr.prev();
    });
    $("#next").click(function () {
        scr.next();
    });

});

   

$.easing.custom = function (x, t, b, c, d) {
    var s = 1.70158;
    if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b;
    return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;
}

