Slick: Feature request: Initial Delay

Created on 11 Nov 2014  路  4Comments  路  Source: kenwheeler/slick

I like this feature in other carousels/cycles. New option, delay. Number. An initial timeout that runs before you kick off your auto advance autoPlayTimer interval.

Use case is on page load, users need a few second(s) to orient themselves before a slider interval should kick in.

Most helpful comment

Method names changed. Currently it should look like:

var slider = $('.slider');

slider.slick({
    autoplay: true,
    autoplaySpeed: 1000
}).slick("slickPause");

var initialDelay = 3000;

setTimeout(function() {
    slider.slick("slickPlay");
},initialDelay);

All 4 comments

Here, I'll even take the opportunity to improve your UX :wink:

$(".slider").slick({
    autoplay: true,
    autoplaySpeed: 1000
}).slickPause();

var initialDelay = 3000;

$(document).one("mousemove touchstart", function() {
    setTimeout(function() {
        $(".slider").slickPlay();
    },initialDelay);
});

here's a JSFiddle to show you how: http://jsfiddle.net/p36wbk44/1/ :kiss:

Guys, doesn't seem to work anymore in jsfiddle?

That's because the API methods changed. The logic is still sound.

$(".slider").slick({
    autoplay: true,
    autoplaySpeed: 1000
}).slick("pause");

var initialDelay = 3000;

$(document).one("mousemove touchstart", function() {
    setTimeout(function() {
        $(".slider").slick("play");
    },initialDelay);
});

Method names changed. Currently it should look like:

var slider = $('.slider');

slider.slick({
    autoplay: true,
    autoplaySpeed: 1000
}).slick("slickPause");

var initialDelay = 3000;

setTimeout(function() {
    slider.slick("slickPlay");
},initialDelay);
Was this page helpful?
0 / 5 - 0 ratings

Related issues

stephane-r picture stephane-r  路  3Comments

hoghamburg picture hoghamburg  路  3Comments

jamesinealing picture jamesinealing  路  3Comments

NozX18 picture NozX18  路  3Comments

jeremymandel picture jeremymandel  路  3Comments