Despite the fact that the above answer fits the scenario <ul>and <li>it will not work very well for a more complex situation. To really dial this, functionality must be wrapped in a function that accepts the target element and delays input. The function will then take this element and set a timeout with a delay for ... sigh, this is too important, I just have to encode it:
function applyAnimation(element, delay){
setTimeout(function(){ $(element).addClass('animation'); }, delay);
var children = document.getElementById(id).children;
for( var i = 0; i < children.length; i++){
applyAnimation(children[i],(2+i) * delay);
}
}
source
share