Hello, Working on a university school project about video game commentary and making a web page about it. I thought it would be fun to place the "Konami code" in the webpage so if someone were to type the sequence, something fun would pop up. Problem I'm having is I'm noticing several different versions of this.
This is what I've found.
var konami_keys = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65];
var konami_index = 0;
$(document).keydown(function(e){
if(e.keyCode === konami_keys[konami_index++]){
if(konami_index === konami_keys.length){
$(document).unbind('keydown', arguments.callee);
$.getScript('http://www.cornify.com/js/cornify.js',function(){
cornify_add();
$(document).keydown(cornify_add);
});
}
}else{
konami_index = 0;
}
});
Now I'm no expert. So Question 1: one is this the "best" way to do this for a website? Question 2: If i want to add a picture and have it move around the page, what additional coding will be required?