From d2b2e051faaf4a9c012149ec22968c3c72b4217c Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Mon, 27 Apr 2015 12:16:07 +0200 Subject: More fixes to viewcompetition --- viewcompetition.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/viewcompetition.js b/viewcompetition.js index be44b52..543f25f 100644 --- a/viewcompetition.js +++ b/viewcompetition.js @@ -135,8 +135,9 @@ function bgcell(idx){ return document.getElementById("bgtbody").children[idx/S|0].children[idx%S]; } function fgcellposition(idx){ - var rect=bgcell(idx).getBoundingClientRect(); - return [rect.left,rect.top+document.documentElement.scrollTop]; + var rect=bgcell(idx).getBoundingClientRect(), + scrolltop=window.pageYOffset||document.documentElement.scrollTop; + return [rect.left,rect.top+scrolltop]; } function movefgcell(e,idx){ var pos=fgcellposition(idx); @@ -149,7 +150,7 @@ function makefgcell(idx,type){ //type in [1,2,3] e=document.createElement("div"); e.classList.add("fgcell"); e.classList.add("celltype_"+type); - e.style="left:"+pos[0]+"px;top:"+pos[1]+"px;"; + e.setAttribute("style","left:"+pos[0]+"px;top:"+pos[1]+"px;"); e.cell_index=idx; e.appendChild(document.createElement("div")); return e; -- cgit v1.2.3-54-g00ecf