Attempt to fix scrolling effects on smartphone (reloading page...)
[xogo.git] / app.js
diff --git a/app.js b/app.js
index 5a46190..a011513 100644 (file)
--- a/app.js
+++ b/app.js
@@ -59,10 +59,19 @@ function toggleVisible(element) {
     if (elt.id != element) elt.style.display = "none";
     else elt.style.display = "block";
   }
-  if (element.id == "newGame") {
-    // Workaround "superposed texts" effect
-    inputName.focus();
-    inputName.blur();
+  if (element.id == "boardContainer") {
+    // Avoid smartphone scrolling effects (TODO?)
+    document.querySelector("html").style.overflow = "hidden";
+    document.body.style.overflow = "hidden";
+  }
+  else {
+    document.querySelector("html").style.overflow = "visible";
+    document.body.style.overflow = "visible";
+    if (element.id == "newGame") {
+      // Workaround "superposed texts" effect
+      inputName.focus();
+      inputName.blur();
+    }
   }
 }