Html issue Iframe,Canvas

535 Views Asked by At

I use this gameengine pico8 and you can export a html version of your game. I put it in on my website but now every other iframe frome my website isn´t working the way it should anymore i guess the code from pico8 messed something up but im not skilled enough to figure out what i must change to fix it. Here the code i guess which makes the problem (canvas overweiting iframes or something?):

<STYLE TYPE="text/css">
canvas#canvas { width: 512px; height: 412px; }

canvas{
    image-rendering: optimizeSpeed;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: optimize-contrast;
    image-rendering: pixelated;
    -ms-interpolation-mode: nearest-neighbor;
    border: 0px
}
</STYLE>

              <canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>

              <script type="text/javascript">
                var canvas = document.getElementById("canvas");
                canvas.width = window.innerWidth;
                canvas.height = window.innerHeight;

                var Module = {};
                Module.canvas = canvas;

              </script>

              <script async type="text/javascript" src="mywikinggame.js"></script>

              <script>

                function onKeyDown_blocker(event) {
                  event = event || window.event;
                  var o = document.activeElement;
                  if (!o || o == document.body || o.tagName == "canvas")
                  {
                    if ([32, 37, 38, 39, 40].indexOf(event.keyCode) > -1)
                    {
                      if (event.preventDefault) event.preventDefault();
                    }
                  }
                }

                document.addEventListener('keydown', onKeyDown_blocker, false);

              </script>
              </div></center>
1

There are 1 best solutions below

1
On BEST ANSWER

i have no idea why but i sleeped a night and now it works <:P