Close. Take out your zIndex option and it should automatically revert for you. 
The zIndex used while dragging by defaults is 1000 and after you release it 
should drop back to what it was before.

The reason it drops behind the other is because of the way it is attached to 
the DOM. zIndices are relatative to the parent node only. Thus if you have two 
items under the same parent node with the same zIndex the one that was added 
last is shown on top. If you want to show it behind the other, set its original 
zIndex lower than the other before the drag starts.

new Draggable('g-' + 
G.cg,{handle:'dragbutton',revert:function(el){setCurrent(el)}});

-Andrew Martinez

 -----Original Message-----
From:   [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]  On Behalf Of Sam Rowe
Sent:   Tuesday, May 23, 2006 2:48 PM
To:     [email protected]
Subject:        [Rails-spinoffs] Draggables and z-index


I'm using Draggagle on a couple of divs and when I drop the first one, it'll
always drop behind (in terms of z-index) the second one. I even added a
revert function to add a CSS class to the div that should raise it up, but I
think the style.zIndex is "winning." 

Looking at the code, it seems like the zIndex stuff is set *after*
the revert function is called... is there any way to do what I'm
trying to do?

Here's my call to Draggable just in case it's obviously stupid:

new Draggable('g-' + 
G.cg,{handle:'dragbutton',revert:function(el){setCurrent(el)},zIndex:false});

Thanks!
_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to