Bob90
03-28-2007, 02:37 PM
:confused:
Here it is: I set the position of a div dynamically, it flips the directions.
You would think it would be a case of swapping the co-ordinates assigned, but no.
Does anyone know what I'm doing wrong?
var el = document.getElementById("startDiv");
if(debug){document.getElementById("debugText").value +="Start at"+el.style.left+","+el.style.top+"\n"}
el.style.top = parseInt(pos_f_y2*(this.tileSize+this.tileSpacing))+"px"
el.style.left = parseInt(pos_f_x2*(this.tileSize+this.tileSpacing))+"px"
if(debug){document.getElementById("debugText").value +="Start at"+el.style.left+","+el.style.top+"\n\n"}
//if(debug){document.getElementById("debugText").value +="Z:"+el.style.zIndex+"\n"}
this.startTileX = pos_f_x2;
this.startTileY = pos_f_y2;
return true;
I've just added part of the code. If you need to see the whole thing, just ask, and I'll upload it.
:)
Here it is: I set the position of a div dynamically, it flips the directions.
You would think it would be a case of swapping the co-ordinates assigned, but no.
Does anyone know what I'm doing wrong?
var el = document.getElementById("startDiv");
if(debug){document.getElementById("debugText").value +="Start at"+el.style.left+","+el.style.top+"\n"}
el.style.top = parseInt(pos_f_y2*(this.tileSize+this.tileSpacing))+"px"
el.style.left = parseInt(pos_f_x2*(this.tileSize+this.tileSpacing))+"px"
if(debug){document.getElementById("debugText").value +="Start at"+el.style.left+","+el.style.top+"\n\n"}
//if(debug){document.getElementById("debugText").value +="Z:"+el.style.zIndex+"\n"}
this.startTileX = pos_f_x2;
this.startTileY = pos_f_y2;
return true;
I've just added part of the code. If you need to see the whole thing, just ask, and I'll upload it.
:)