jQuery Plugin To Enable Konami Cheat Code On Website - Konami Code

jQuery Plugin To Enable Konami Cheat Code On Website - Konami Code
File Size: 9.05 KB
Views Total: 604
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Konami Code is a jQuery plugin that executes a callback function when a keypress cheat code is entered on your website. The default key sequence is the classic Konami code: up, up, down, down, left, right, left, right, B, A. Indented for adding an Easter Egg to your webpage.

See also:

How to use it:

1. Add jQuery library and the jQuery Konami Code plugin to your web pages.

<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="/path/to/jquery.konami.js"></script>

2. Call the function on the window or a specified element to execute a callback when the Konami code is entered.

$( window ).konami({
  cheat: function() {
    alert( 'Cheat code activated!' );
  } 
});

3. Set your own cheat code.

$( window ).konami({
  code : [38,38,40,40,37,39,37,39,66,65],
});

4. More parameters.

$( window ).konami({

  //  jQuery event name for default callback
  eventName : 'konami',

  // event property override for default callback
  eventProperties : null,
  
});

Change log:

2015-12-05

  • v1.3.3

This awesome jQuery plugin is developed by tommcfarlin. For more Advanced Usages, please check the demo page or visit the official website.