Love it, although I had to make some modifications to get it to work. Your function without the {} brackets didn't run, also add in the key '13' as this is the enter key (aka start).
[code] $(function (){ var press = 0, keys = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13]; $(document).keydown(function (e){ if (e.which == keys[press]) { press++; } else { press = 0; }; if (press == keys.length) {function (){ // your little treat... }; }); }); [/code] On Nov 16, 3:03 pm, Ash <takingsi...@gmail.com> wrote: > Every body loves a little treat in their websites... > > Well I believe jQuery holds the PERFECT javascript library for doing > the Konami Code. A fan of Konami, and having such a cool little hidden > feature to your websites, I decided i'd share my code with the world, > or at least > those people who'd like it.. > > Just like the PHP logo change, creativity with this little beauty will > keep your mind going for ever ;) > > [code] > $(function (){ > var press = 0, keys = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65]; > > $(document).keydown(function (e){ > if (e.which == keys[press]) > press++; > else > press = 0; > > if (press == keys.length) > (function (){ > // your little treat... > }); > });}); > > [/code]