Skip to content

Instantly share code, notes, and snippets.

@jescalan
Forked from anonymous/main.js
Last active December 14, 2015 07:19
Show Gist options
  • Save jescalan/5049837 to your computer and use it in GitHub Desktop.
Save jescalan/5049837 to your computer and use it in GitHub Desktop.
A better setTimeout
$(function(){
$('#boxes li').on('click', function(){
var self = $(this);
self.addClass('selected');
wait(self, function(){
this.removeClass('selected');
}, 1000);
});
function wait(context, callback, time){
setTimeout(function(){ callback.call(context); }, time);
};
});
@technomad
Copy link

I like how you solved this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment