Jump to content

How would i go about creating this?


adam291086

Recommended Posts

 
<head>
<style>
<!--
.dragme{position:relative;}
-->
</style>
<script language="JavaScript1.2">
<!--

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>
</head>

<input type="button" value="Move Me" class="dragme"> <br />
<input type="button" value="Move Me" class="dragme"> <br />

thats what i am working on.

i just want it now so when the user moves a box it stays in the possition they moved if you work that out let me know.

Yeah what i want is say like user moves the boxes like so.

 

Box 1                                                                                  Box 3

 

                                      Box 2

 

When he returns to the page the boxer are still set like :

 

Box 1                                                                                  Box 3

 

                                      Box 2

 

And not back to normal

 

Box1

2

3

 

i have tried all sorts even re wrote the script i just cant seem to get them to stay in the same place.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.