get element position

Posted by hopes on Stack Overflow See other posts from Stack Overflow or by hopes
Published on 2010-06-02T18:06:12Z Indexed on 2010/06/02 18:14 UTC
Read the original article Hit count: 255

Filed under:
|

how can i know that a specific is on another specific after dragging the first and drop it I am using this code in the head of my document to enable drag and drop of my divs

var dragapproved=false
var z,x,y
function move(){
if (event.button==1&&dragapproved){
z.style.pixelLeft=temp1+event.clientX-x
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
}
}
document.onmousedown=drags
document.onmouseup=new Function('dragapproved=false')

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about html