I'm making a facebook game and the users asked me to make the game start by pressing spacebar, because clicking on a button wastes their time. I tried to make it by this code:
jQuery("body").focus().bind('keyup', function (e) { if ( e.keyCode == 32 ){
startgame();
}});
But this code doesn't work in the app (http://apps.facebook.com/typepractice/), but it works in the site (http://typepractice.php5.sk/). Is Facebook blocking the key events? Please, help me.
I made it work by adding event to a button, not a body element. It works now
jQuery(".game input[type='button']")
.focus()
.css({"cursor":"pointer"})
.click(startgame)
.keyup(function (e) {
if ( e.keyCode == 32 ){
startgame();
return false;
}
});