Skip to content

Instantly share code, notes, and snippets.

@xdmorgan
Created May 30, 2014 20:53
Show Gist options
  • Save xdmorgan/7182eac8200645c5e927 to your computer and use it in GitHub Desktop.
Save xdmorgan/7182eac8200645c5e927 to your computer and use it in GitHub Desktop.
Based on chris coyiers konami code, adds konami class to html to override styles and triggers jquery event "KONAMI_CODE" for js fun.
var kkeys = [], konami = "38,38,40,40,37,39,37,39,66,65";
$(document).keydown(function(e) {
kkeys.push( e.keyCode );
if ( kkeys.toString().indexOf( konami ) >= 0 ) {
$(document).unbind('keydown',arguments.callee);
// do something awesome
$("html").addClass("konami");
$(window).trigger('KONAMI_CODE');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment