jQuery Konami Code Listener


/ Published in: jQuery
Save to your folder(s)

This is the code to add to a website to listen for the Konami Code (as implemented on jQuery.com"


Copy this code and paste it in your HTML
  1. if ( window.addEventListener ) {
  2. var kkeys = [], konami = "38,38,40,40,37,39,37,39,66,65";
  3. window.addEventListener("keydown", function(e){
  4. kkeys.push( e.keyCode );
  5. if ( kkeys.toString().indexOf( konami ) >= 0 )
  6. // User entered Konami Code, do something cool!!!
  7. }, true);
  8. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.