gibney.org
:
Technology
:
Javascript
:
Experiments
:
Mover Test
(Entry Nr. 244, by user 1 |
edit
)
<style> .TabEntry { visibility: collapse; } </style> <span style="position: relative; top: 300px; left: 300px;">Hallo Welt!</span> <span style="position: relative; top: 300px; left: 200px; font-size: 500%">→</span> <img src="http://www.gibney-enterprises.de/images/size00/0009.jpg"> <script> if ('undefined'==typeof(ge_included)) { ge_included_left2load=0; ge_included=new Object(); ge_included["http://javascript.gibney.org/standards.js"]=true; function ge_require_once(src) { if(ge_included[src]) return; ge_included_left2load++; var sn=document.createElement("script"); sn.onload=function(){ ge_included_left2load--; } sn.onreadystatechange=function(){ if(this.readyState=='loaded' || this.readyState=='complete'){ ge_included_left2load--;this.onreadystatechange=null; } } sn.type="text/javascript"; sn.src=src; document.body.appendChild(sn); var obj=document.body.appendChild(sn); ge_included[src]=true; } function startMain() { if (ge_included_left2load==0) main(); else setTimeout("startMain()",250); } } ge_require_once('http://javascript.gibney.org/dynamic_html_elements.js'); function ge_get2dObject() { } function DragAll() { var DragObject = null; var OffsetX = null; var OffsetY = null; this.onmousedown=function(e) { if (!e) e=window.event; // bei IE in dieser Objekteigenschaft zu finden DragAllInstance.DragObject = isDOM ? e.target : event.srcElement; DragAllInstance.DragObject.style.position = "relative"; x=parseInt(DragAllInstance.DragObject.style.left); y=parseInt(DragAllInstance.DragObject.style.top); if (isNaN(x)) x=0; if (isNaN(y)) y=0; DragAllInstance.OffsetX = e.clientX-x; DragAllInstance.OffsetY = e.clientY-y; DragStartX=e.clientX DragStartY=e.clientY document.onmousemove = DragAllInstance.onmousemove; document.onmouseup = DragAllInstance.onmouseup; return false; } this.onmousemove=function(e) { if (!e) e=window.event; // bei IE in dieser Objekteigenschaft zu finden if ((e.shiftKey) || (e.modifiers && e.modifiers==4)) // shift key { DragAllInstance.DragObject.style.width = e.clientX-DragAllInstance.OffsetX; DragAllInstance.DragObject.style.height = e.clientY-DragAllInstance.OffsetY; } else { DragAllInstance.DragObject.style.left = e.clientX-DragAllInstance.OffsetX; DragAllInstance.DragObject.style.top = e.clientY-DragAllInstance.OffsetY; } return false; } this.onmouseup=function(e) { document.onmousemove = null; document.onmouseup = null; DragAllInstance.DragObject = null; return false; } this.click=function(e) { if (!e) e=window.event; // bei IE in dieser Objekteigenschaft zu finden return (DragStartX==e.clientX&&DragStartY==e.clientY); // Nur bei Klick ohne Drag wird ein Anchor ausgeführt } } function main() { DragAllInstance=new DragAll(); document.onmousedown=DragAllInstance.onmousedown; document.onclick=DragAllInstance.click; // message=createDiv('cm1',10,10,'<table style="background-color:#ffffff;border:1px solid #000000;color:#000000;"><tr><td style="padding: 0.5em;"><a href="http://en.gibney.org/sorter_info/" target=_blank><img src="http://en.gibney.org/elements/images/mg-sign.gif" style="border: 0;"></a></td><td style="padding: 0.5em;"><b style="color: #008000;">The Mover</b> V0.6 is active.<br>You can drag and drop anything now.</td></tr></table>'); message.style.zIndex=9999; } var isDOM=document.getElementById&&!document.all; startMain(); </script>
Create a new entry at this position