diff options
author | tomsmeding <hallo@tomsmeding.nl> | 2015-04-27 12:16:07 +0200 |
---|---|---|
committer | tomsmeding <hallo@tomsmeding.nl> | 2015-04-27 12:16:07 +0200 |
commit | d2b2e051faaf4a9c012149ec22968c3c72b4217c (patch) | |
tree | 6d91f03c80e1b156c845a15864bcf1e5e54127f0 | |
parent | 10221d269c5af4985e73cb9c6efb96debbc10562 (diff) |
More fixes to viewcompetition
-rw-r--r-- | viewcompetition.js | 7 |
1 files 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; |