Skip to content
Ryc O'Chet edited this page Jun 10, 2018 · 1 revision
- NOTE: This documentation is for Velocity v2.

Option - Stagger

Specify the stagger option in ms to successively delay the start of an animation on each element in a set by the targeted amount. The first animation will get no increased delay, while the nth will get an extra n x stagger delay (on top of any delay option specified).

var elements = [ element1, element2, element3 ];

elements.velocity({
    left: "10em"
}, {
    stagger: 100,
    duration: 1000
});

Callback

It is possible to supply a callback function for this option. With this you get the element as this, the index as the first argument, the element count as the second, the array of elements as the third, and the string "stagger" as the fourth.

var elements = [ element1, element2, element3 ];

elements.velocity({
    left: "10em"
}, {
    stagger: function(index, length, elements, option) {
        return Math.sqrt(index + length);
    },
    duration: 1000
});