Last active
September 16, 2016 07:56
-
-
Save damirm/9ab8119c46cf17f7bed755f6a76c0942 to your computer and use it in GitHub Desktop.
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
function shrug(el, speed, i) { | |
var enabled = true; | |
var shurgs = [ | |
"¯\\_(ツ)_/¯", | |
"_/¯(ツ)_/¯", | |
"_/¯(ツ)¯\\_", | |
"¯\\_(ツ)¯\\_" | |
]; | |
if (typeof i === 'undefined' || i >= shurgs.length) { | |
i = 0; | |
} | |
el.innerText = shurgs[i]; | |
var timeout = setTimeout(function () { | |
enabled && shrug(el, speed, ++i); | |
}, speed); | |
return function () { | |
clearTimeout(timeout); | |
enabled = false; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment