How to disable parent page scrolling

I have iframe html5 game with arrow keys control. Task is to disable parent page scrolling when arrow keys pressed.


Add next code to iframe head block:

window.addEventListener("keydown", function(e) {
    // space and arrow keys
    if([32, 37, 38, 39, 40].indexOf(e.keyCode) > -1) {
}, false);


Leave a Reply

Your email address will not be published. Required fields are marked *

Enter Captcha Here :