aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--viewcompetition.js7
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;