Can anyone guide me how to convert this drag script:
Into a drag-resize script?? Any help would be greatly appereciated.Code:... <script type="text/javascript"> var ie = document.all; var ns = document.getElementById && !ie; var isdrag = false; var x,y; var dobj; function mousemove(e){ if(isdrag){ dobj.style.left = ns ? tx + e.clientX - x : tx + event.clientX - x; dobj.style.top = ns ? ty + e.clientY - y : tx + event.clientY - y; return false; } } functions startDrag(e){ var fobj = ns ? e.target : event.srcElement; var topelement = ns ? "HTML" : "BODY"; if(fobj.tagName != topelement && fobj.className != "drag"){ fobj = ns ? fobj.parentNode : fobj.parentElement; } if(fobj.className == "drag"){ isdrag = true; dobj = fobj; tx = parseInt(dobj.style.left + 0); ty = parseInt(dobj.style.top + 0); x = ns ? e.clientX : event.clientX; y = ns ? e.clientY : event.clientY; document.onmousemove = mousemove; return false; } } document.onmousedown = startDrag; document.onmouseup = function(){isdrag=false;} </script> <body> <div style="height:100px;width:100px;background-color:red;position:relative;" class="drag"></div> ...
And yes, can anyone also tell me how to detect if the element which is to be dragged is in a certain position in the screen?? Something which might help in making a drag-drop shopping cart??
Thank you again.



Reply With Quote


Bookmarks