From ac9478862e83544ce5cd2aef515f0fe8c4e04718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Sat, 1 Apr 2023 13:57:28 +0200 Subject: [PATCH] Mobile fix --- index.js | 63 +++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 56 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 7a858ba..2d34359 100644 --- a/index.js +++ b/index.js @@ -18,8 +18,10 @@ function makeSpaceWord(word){ $("#imagesky").html(""); let length = word.length; for (var i = 0; i < length; i++) { - $("#lettersky").append('
'); - $("#imagesky").append('
'); + $("#lettersky").append('
'); + ranid++; + $("#imagesky").append('
'); + ranid++; } $("#lettersky").append('
'); $("#imagesky").append('
'); @@ -126,6 +128,28 @@ function randomize(inarray){ return tmp; } +function getEmptyIndex(element) { + var emptyPlaces = []; + var idcka = []; + var finalindex = -1; + var idcko = ""; + element.each(function (){ + let thiselement = $(this); + if (thiselement.html() == ""){ + emptyPlaces.push(thiselement.attr("finalplaceindex")); + idcka.push(thiselement.attr("id")); + } + }); + + emptyPlaces.forEach(function (value, index) { + if (value < finalindex || finalindex < 0){ + finalindex = value; + idcko = idcka[index]; + } + }); + return [finalindex, idcko]; +} + function showImages() { var images = []; var letters = []; @@ -137,7 +161,7 @@ function showImages() { let audiopath = prefix + "audio/" + data_tabl[i] + ".ogg"; images.push( - "
" + + "
" + "" + "