jQuery Konami代码监听器

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jQuery Konami代码监听器相关的知识,希望对你有一定的参考价值。

This is the code to add to a website to listen for the Konami Code (as implemented on jQuery.com"
  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. }

以上是关于jQuery Konami代码监听器的主要内容,如果未能解决你的问题,请参考以下文章