Skip to content

Instantly share code, notes, and snippets.

@bernardeli
Created March 19, 2012 01:36
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 bernardeli/2089571 to your computer and use it in GitHub Desktop.
Save bernardeli/2089571 to your computer and use it in GitHub Desktop.
konami code js
$(window).konami(function(){
$(".goku").show();
$(".goku").delay(2000).fadeOut();
});
(function($) {
$.fn.konami = function(callback, code) {
if(code == undefined) code = "38,38,40,40,37,39,37,39,66,65";
return this.each(function() {
var kkeys = [];
$(this).keydown(function(e){
kkeys.push( e.keyCode );
if ( kkeys.toString().indexOf( code ) >= 0 ){
$(this).unbind('keydown', arguments.callee);
callback(e);
}
});
});
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment