Sunday, August 21, 2016

Oft-used Velocity.js methods

Scroll to an element
$element.velocity("scroll", { duration: 600, easing: "easeInSine"});

Stop existing velocity animations before running (de-queue)
$element.velocity("stop").velocity(...);

Adjust height
$element.velocity({ height: '400px' });

Adjust transform
$element.velocity({ translateY: '-100%' });

Fade in element
$element.velocity({ opacity: 1 }, { display: "block" });

Fade in element w/ a delay
$element.velocity({ opacity: 1 }, { display: "block", delay: 400 });

Fade out element
$element.velocity({ opacity: 0 }, { display: "none" });

No comments:

Post a Comment