Hello guys,

I'm in a dilemma regarding a Jquery script

What I want to do: I have a couple of images that I want to put over another image using drag (and drop)
The only thing is, that "the drop", needs to be on specific X Y coordinates.

I have tried do make a code up and I finally managed to get one working, but the issue is that i won't stop the drop where I want it.

Here's my code:

Code:
<script>
<!--
var ie=document.all;
var nn6=document.getElementById&&!document.all;

var isdrag=false;
var x,y;
var dobj;

function movemouse(e) {
  if (isdrag)  {
    dobj.style.left = nn6 ? tx + e.clientX - x : tx + event.clientX - x;
    dobj.style.top  = nn6 ? ty + e.clientY - y : ty + event.clientY - y;
    return false;
  }
}

function selectmouse(e) {
  var fobj       = nn6 ? e.target : event.srcElement;
  var topelement = nn6 ? "HTML" : "BODY";

  while (fobj.tagName != topelement && fobj.className != "dragme") {
    fobj = nn6 ? fobj.parentNode : fobj.parentElement;
  }

  if (fobj.className=="dragme"){
    isdrag = true;
    dobj = fobj;
    tx = parseInt(dobj.style.left+0);
    ty = parseInt(dobj.style.top+0);
    x = nn6 ? e.clientX : event.clientX;
    y = nn6 ? e.clientY : event.clientY;
    document.onmousemove=movemouse;
    return false;
  }
}

document.onmousedown=selectmouse;
document.onmouseup=new Function("isdrag=false");

//-->
</script>
I've been researching only for a possibility to define specific variables, and none of the functions work (or maybe I don't know how to adapt then...

Something like this:
Code:
var offset = $(this).offset();
var xPos = Math.abs(offset.left);
var yPos = Math.abs(offset.top);
Does anyone have any ideas ?!

My best regards,
Michael