Skip to content

Commit

Permalink
Merge pull request EasyRPG#1188 from rygos/master
Browse files Browse the repository at this point in the history
WebPlayer: fixes unwanted scrolling on Arrowkey press
  • Loading branch information
Marcel Hering authored and carstene1ns committed May 31, 2017
1 parent 9faa53e commit a9e48b6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions resources/emscripten/emscripten-shell.html
Expand Up @@ -81,5 +81,14 @@
};
</script>
{{{ SCRIPT }}}
<script>
//prevents scrolling on arrow key press
window.addEventListener("keydown", function(e) {
// space and arrow keys, from 112 to 123 for function keys (only works in some browsers)
if([32, 37, 38, 39, 40, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123].indexOf(e.keyCode) > -1) {
e.preventDefault();
}
}, false);
</script>
</body>
</html>

0 comments on commit a9e48b6

Please sign in to comment.