Skip to content

Instantly share code, notes, and snippets.

@kaskajp
Last active August 29, 2015 14:17
Show Gist options
  • Save kaskajp/2c7f421c8b19284d09d8 to your computer and use it in GitHub Desktop.
Save kaskajp/2c7f421c8b19284d09d8 to your computer and use it in GitHub Desktop.
Sequence Add Class
var sequenceAddClass = function(els) {
function addClassWithTimeout(i, el) {
var t = setTimeout(function() {
clearTimeout(t);
el.className = el.className + "addsomeclass";
}, i * 200);
}
for (var i = 0; i < els.length; i++) {
addClassWithTimeout(i, els[i]);
}
};
var elements = document.querySelectorAll('img');
sequenceAddClass(elements);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment