adam291086 Posted December 19, 2007 Share Posted December 19, 2007 How does this site work. I am looking to create something like this. http://www.redbridge.gov.uk/ Quote Link to comment Share on other sites More sharing options...
beansandsausages Posted December 19, 2007 Share Posted December 19, 2007 its made in javascript drag and drop haha but you knew that. i tried sum it like that be for. i did have a sample for you but deleted it as i posted it clicked delete and im not typing it out again ha. Quote Link to comment Share on other sites More sharing options...
adam291086 Posted December 19, 2007 Author Share Posted December 19, 2007 oh burnside that would og been so helpful. If you feel the erge to type let me know. I dont know alot of java. So a simple example would be very helpful Quote Link to comment Share on other sites More sharing options...
beansandsausages Posted December 19, 2007 Share Posted December 19, 2007 <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. Quote Link to comment Share on other sites More sharing options...
adam291086 Posted December 19, 2007 Author Share Posted December 19, 2007 ok i will keep you posted. Although i am not a java man Quote Link to comment Share on other sites More sharing options...
beansandsausages Posted December 19, 2007 Share Posted December 19, 2007 did that work and is that what you wanted? i mean easy enuff to edit the code Quote Link to comment Share on other sites More sharing options...
adam291086 Posted December 19, 2007 Author Share Posted December 19, 2007 yeah it work well. Just trying to understand it. Surly to keep it in postion you will need to edit the dragme{position:releative} to = the mouse co ordinates. Quote Link to comment Share on other sites More sharing options...
beansandsausages Posted December 19, 2007 Share Posted December 19, 2007 tried and it doesnt move the boxes at all. Quote Link to comment Share on other sites More sharing options...
beansandsausages Posted December 19, 2007 Share Posted December 19, 2007 any one got any ideas?? im compleatly stuck. Quote Link to comment Share on other sites More sharing options...
adam291086 Posted December 19, 2007 Author Share Posted December 19, 2007 do you mean when the user navigates away and returns the boxes are still in the same place? Quote Link to comment Share on other sites More sharing options...
beansandsausages Posted December 19, 2007 Share Posted December 19, 2007 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. Quote Link to comment Share on other sites More sharing options...
adam291086 Posted December 19, 2007 Author Share Posted December 19, 2007 i dont think it is possible. This is because you are calling on the style sheet every time. Unless there is away to turn the postion into px. Then you could chage the style sheet accordingly. Thus keeping the postion. No idea how though Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.