Skip to content

Instantly share code, notes, and snippets.

@webag
Created November 15, 2018 07:18
Show Gist options
  • Save webag/e51bfc14cb6c27172d8808a8ced870ca to your computer and use it in GitHub Desktop.
Save webag/e51bfc14cb6c27172d8808a8ced870ca to your computer and use it in GitHub Desktop.
waypoint stagger
/***********************
Waypoints BEGIN
***********************/
$(function () {
var itemQueue = [];
var delay = 150;
var queueTimer;
function processItemQueue() {
if (queueTimer) return;
queueTimer = window.setInterval(function () {
if (itemQueue.length) {
$(itemQueue.shift()).addClass('animated');
processItemQueue()
} else {
window.clearInterval(queueTimer);
queueTimer = null;
}
}, delay)
}
$('.anim').waypoint(function () {
itemQueue.push(this.element);
processItemQueue()
}, {
offset: '85%'
});
});
/***********************
Waypoints END
***********************/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment