Created
November 15, 2018 07:18
-
-
Save webag/e51bfc14cb6c27172d8808a8ced870ca to your computer and use it in GitHub Desktop.
waypoint stagger
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*********************** | |
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