Last active
August 29, 2015 14:17
-
-
Save kaskajp/2c7f421c8b19284d09d8 to your computer and use it in GitHub Desktop.
Sequence Add Class
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
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