Skip to content

Instantly share code, notes, and snippets.

@tomauty
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomauty/aa9cc3cc87bc61840d73 to your computer and use it in GitHub Desktop.
Save tomauty/aa9cc3cc87bc61840d73 to your computer and use it in GitHub Desktop.
lol2.js
// hover
var i = undefined;
$('a').mouseover(function() {
var dest = $(this);
var string = dest.text();
var c = 0;
dest.text('');
i = setInterval(function () {
if (c >= string.length) {
clearInterval(i);
dest.text(string);
} else {
$('<span>').text(string[c])
.appendTo(dest).hide().fadeIn(100);
c += 1;
console.log(string[c]);
}
}, 50);
}).mouseout(function() {
clearInterval(i);
c = 0;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment