Home Button Go To First Scene

Can I use JavaScript to make the HOME key on a users keyboard take them to the first scene? If so, what code could I use? Thanks.

Yup, that key code is 36. But keep in mind that not everyone has a 'home' button readily available on their keyboard.

This page is a quick way to get keycodes which lets you link keyboard actions to JS functions:

document.onkeydown = checkKey;

function checkKey(e) {
    e = e || window.event;
    if (e.keyCode == '36') {
        //home button
        hypeDocument.showSceneNamed('Scene 1', hypeDocument.kSceneTransitionCrossfade, 1.1)
    }
}

More info here:

1 Like

Thanks Daniel! I also have a home button to click as an alternative.

1 Like