in parte ho fatto..... ho solo un problema... non riesco a fare in modo che quando l'immagine finisce non scorra +a destra e in basso, questa cosa son riusito a farla per l'alto e la sinistra.... suggerimenti?
<form name="test" ID="Form1">
<div style="OVERFLOW: hidden; width:300px; height:300px" id="testing">
[img]../test.gif[/img]
</div>
</form>
<script language="javascript">
Codice PHP:
var div=document.getElementById('testing');
div.onmousedown=drags;
div.onmouseup=new Function("dragapproved=false")
var dragapproved=false
var z,x,y
function move(){
if (event.button==1){
if (div.style.pixelLeft>=temp1+event.clientX-x){ // limite sinistro
z.style.pixelLeft=temp1+event.clientX-x
}
if (div.style.pixelTop>= temp2+event.clientY-y){ // limite alto
z.style.pixelTop=temp2+event.clientY-y
}
return false
}
}
function drags(){
if (!document.all)
return
if (event.srcElement.className=="drag"){
dragapproved=true
z=event.srcElement
temp1=z.style.pixelLeft
temp2=z.style.pixelTop
x=event.clientX
y=event.clientY
document.onmousemove=move
}
}