Posted By

jackkeller on 11/01/11


Tagged

jquery


Versions (?)

Konami Code


 / Published in: JavaScript
 

  1. var kkeys = [], konami = "38,38,40,40,37,39,37,39,66,65";
  2.  
  3. $(document).keydown(function(e) {
  4.  
  5.   kkeys.push( e.keyCode );
  6.  
  7.   if ( kkeys.toString().indexOf( konami ) >= 0 ) {
  8.  
  9.     $(document).unbind('keydown',arguments.callee);
  10.  
  11.     // do something awesome
  12.     $("body").addClass("konami");
  13.  
  14.   }
  15.  
  16. });

Report this snippet  

You need to login to post a comment.