I stedet for at have denne kode:
while(isMouseUp == false)
{
objectLeft = object.style.left;
objectTop = object.style.top;
mouse_objectOffsetX = objectLeft - mousePosX;
mouse_objectOffsetY = objectTop - mousePosY
object.style.left = mousePosX;
object.style.top = mousePosY;
}
så brug onmousemove så i din div skrive du onmousemove="onmousemove();"
og din onmousemove ser sådan her ud:
function onmousemove(){
if(isMouseUp === false) {
objectLeft = object.style.left;
objectTop = object.style.top;
mouse_objectOffsetX = objectLeft - mousePosX;
mouse_objectOffsetY = objectTop - mousePosY
object.style.left = mousePosX;
object.style.top = mousePosY;
}
}
skulle virke er ikke testet
Indlæg senest redigeret d. 04.06.2008 23:25 af Bruger #11596