Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Initial Delay #776

Closed
matthewlein opened this issue Nov 11, 2014 · 4 comments
Closed

Feature request: Initial Delay #776

matthewlein opened this issue Nov 11, 2014 · 4 comments

Comments

@matthewlein
Copy link

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.

@simeydotme
Copy link
Collaborator

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

$(".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/ 💋

@jan1980
Copy link

jan1980 commented Jul 16, 2015

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

@simeydotme
Copy link
Collaborator

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);
});

@flowdee
Copy link

flowdee commented Nov 24, 2015

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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants