diff options
author | deva <deva> | 2010-03-01 13:57:23 +0000 |
---|---|---|
committer | deva <deva> | 2010-03-01 13:57:23 +0000 |
commit | b26e4af55e0ebbab8d558e6062631b91b5ffa6be (patch) | |
tree | 1af59e4e9a4f46838f4d259db6564c4847807c3c /utils | |
parent | b5a24c83c59dd09c9f0ea8c348fd12d51d281cd6 (diff) |
Make window transparent on drag.
Diffstat (limited to 'utils')
-rw-r--r-- | utils/admin.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/utils/admin.php b/utils/admin.php index c8c96cf..df3a9df 100644 --- a/utils/admin.php +++ b/utils/admin.php @@ -122,6 +122,9 @@ function InitDragDrop() var x = readCookie('admin_x'); var y = readCookie('admin_y'); + // if(x > document.body.clientWidth) x = document.body.clientWidth - 30; + // if(y > document.body.clientHeight) y = document.body.clientHeight - 30; + var _dragElement = document.getElementById('admin'); _dragElement.style.left = x + 'px'; @@ -139,7 +142,7 @@ function OnMouseDown(e) // for IE, left click == 1 // for Firefox, left click == 0 - if ((e.button == 1 && window.event != null || e.button == 0) && target.className == 'admin') { + if ((e.button == 1 && window.event != null || e.button == 0) && target.className == 'admin') { // grab the mouse position _startX = e.clientX; _startY = e.clientY; @@ -150,8 +153,11 @@ function OnMouseDown(e) // bring the clicked element to the front while it is being dragged _oldZIndex = target.style.zIndex; + _oldOpacity = target.style.opacity; target.style.zIndex = 10000; - + // target.style.opacity = 0.6; + _setOpacity = true; + // we need to access the element in OnMouseMove _dragElement = target; @@ -179,12 +185,18 @@ function OnMouseMove(e) // this is the actual "drag code" _dragElement.style.left = (_offsetX + e.clientX - _startX) + 'px'; _dragElement.style.top = (_offsetY + e.clientY - _startY) + 'px'; + + if(_setOpacity == true) { + _dragElement.style.opacity = 0.6; + _setOpacity = false; + } } function OnMouseUp(e) { if (_dragElement != null) { _dragElement.style.zIndex = _oldZIndex; + _dragElement.style.opacity = _oldOpacity; // we're done with these events until the next OnMouseDown document.onmousemove = null; |