From b26e4af55e0ebbab8d558e6062631b91b5ffa6be Mon Sep 17 00:00:00 2001 From: deva Date: Mon, 1 Mar 2010 13:57:23 +0000 Subject: Make window transparent on drag. --- utils/admin.php | 16 ++++++++++++++-- 1 file 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; -- cgit v1.2.3