PDA

View Full Version : Resolved Changing Z-Index in dom-drag



cdr029
06-04-2009, 08:40 PM
I'm trying out drag-dom for drag-and-drop functionality but am running into a problem I can't find a solution to by googling.

I need the last-dragged object to always have the highest Z-Index so that it is always on top.

The problem is that when my objects (in this case tables) are put into the script's drag-and-drop routine I can no longer alter the Z-Indexes of the tables through conventional means.

For Example when you click an object it runs dragset:

var zin=5; (just to show that 'zin' is declared as a global variable)

function dragset(id)
{
document.getElementById("tbl"+id).style.zIndex=zin;
zin=zin+5;
}

Every time around the next table should have a +5 z-index. This works before the tables are entered into the drag & drop script (I know because the one I apply the value to will always remain on top of all others). As soon as the tables are put into the script their Z-Indexes can no longer be altered with the method above.

Is there another way to alter the Z-Index values on the fly using dom-drag so that the dragged object is always on top?

cdr029
06-05-2009, 03:21 PM
I figured it out...

In the "start:" area of the dom-drag script I put in this code:

zin = zin + 5;
o.style.zIndex = zin;

This seems to work nicely.