From 873fe433621f5336edaaa6f6d25a709c26c52366 Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 10 Apr 2019 20:23:20 -0600 Subject: [PATCH] button fix --- static/script.js | 33 ++++++++++++++++++++++++--------- static/style.css | 2 +- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/static/script.js b/static/script.js index 5152471..fe74cb7 100644 --- a/static/script.js +++ b/static/script.js @@ -23,6 +23,16 @@ function isMobileDevice() { return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) }; + +function buttonCheck(){ + if(typing == true){ + setTimeout(buttonCheck, 500); + } + else{ + document.getElementById('buttons').style.visibility='visible'; + } +} + var StoryTracker = { firstStory: null, lastStory: null, @@ -84,6 +94,10 @@ var StoryTracker = { Typer.appendToText("\nWhich action do you choose? ") StoryTracker.action_int = 0 acceptInput = true + + if(isMobileDevice()){ + setTimeout(buttonCheck, 500); + } } } @@ -130,6 +144,11 @@ var StoryTracker = { Typer.appendToText("\nWhich action do you choose? ") acceptInput = true + + if(isMobileDevice()){ + setTimeout(buttonCheck, 500); + } + } @@ -243,6 +262,8 @@ document.onkeypress = function(evt) { function onButtonClick(num){ + document.getElementById('buttons').style.visibility='hidden'; + if (acceptInput == true){ acceptInput = false num = String(num) @@ -263,15 +284,9 @@ function start(){ startTyping() Typer.startBlinker() - - if(isMobileDevice()){ - console.log("Mobile device"); - } - else{ - console.log("Not mobile device"); - document.getElementById('buttons').style.visibility='hidden'; - } - + + console.log("Not mobile device"); + document.getElementById('buttons').style.visibility='hidden'; } diff --git a/static/style.css b/static/style.css index bf00844..33b212b 100644 --- a/static/style.css +++ b/static/style.css @@ -67,7 +67,7 @@ a { } #buttons { - position: absolute; + position: relative; bottom: 80px; height: 60px; width: 100%;