Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs

non-scrolling game container

A topic by napalmz created 86 days ago Views: 86
Viewing posts 1 to 1

I noticed on this website, the game container scrolls up/down when using the arrow keys for game controls.

For my Arcade I fixed this by disabling scrolling when the mouse is pointed anywhere on the game container.

You won't be able to do it by attempting to disable it for the screen without this method.

You can try but my own tests failed trying to do it that way.

"gamecontainer" is your container id for this example.

Here is the necessary javascript code:

if (window.addEventListener)
   window.addEventListener("load", function (){
      ArcadeFunc();                        
   });
else
   window.attachEvent("onload", function (){
      ArcadeFunc();                        
   });
function ArcadeFunc() {
   var gameObject = document.getElementById("gamecontainer");
   gameObject.onmouseenter = function (){
      document.body.style.overflowY="hidden";
   };
   gameObject.onmouseleave = function (){
      document.body.style.overflowY="auto";
   };
}