Fabian said:
Can you show us the code? It might only require minor tweaking to fit.
And its something I want to do for one of my own projects too. You
wouldn't want to save me loads of time would you
Very simple example (dragging, no effect on dropping):
---
<script type="text/javascript">
function dragImg(img,evt,how) {
how = how || "relative";
img.style.position = how;
var root = document.documentElement || document.body;
var x = img.xPos || (how == "relative" ? 0 : img.offsetLeft);
var y = img.yPos || (how == "relative" ? 0 : img.offsetTop);
var mx = evt.pageX || evt.clientX + root.scrollLeft;
var my = evt.pageY || evt.clientY + root.scrollTop;
document.onmousemove = function (evt){
evt = evt || window.event;
var newmx = evt.pageX || evt.clientX + root.scrollLeft;
var newmy = evt.pageY || evt.clientY + root.scrollTop;
x += newmx - mx;
y += newmy - my;
mx = newmx;
my = newmy;
img.style.left = x+"px";
img.style.top = y+"px";
img.style.outline="2px solid gray";
img.style.zIndex = "1";
return false;
}
document.onmouseup = function () {
document.onmousemove = document.onmouseup = null;
img.xPos = x;
img.yPos = y;
img.style.outline = img.style.zIndex = "";
return false;
}
return false;
}
</script>