What is this? Something unexpected happens when someone presses designated keys? Easter Eggs?
Got an example site? Rick -----Original Message----- From: Marc Henson [mailto:m...@marchenson.co.uk] Sent: Wednesday, November 18, 2009 5:35 AM To: jquery-en@googlegroups.com Subject: Re: [jQuery] Konami Code >:] Can I just say.... Brilliant!! I think this will probably make it's way onto my site/s at some point fairly soon!! Thanks On 16 Nov 2009, at 21:03, Ash 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]