It looks like you are doing some kind of editing. :)
The solution sets two blocks to the same z-index, and then omits the brother's z-index (the field in which the card did NOT end) using the "start" event. The stop event should set them equal again. Of course, the drag and drop itself needs a higher z-index.
You can also try the stack .
EDIT: Working example. Note that its actually a drag-and-drop event that should set the z-indexs values ββagain.
You will need to make these changes (of course, leave asterisks in your code):
In dragdrop-client.js
// make the new card draggable newCard.draggable({ zIndex: 2500, handle: ".card", stack: ".card", revert: "invalid", start: function() { $(this).effect("highlight", {}, 1000); $(this).css( "cursor","move" ); **var $par = $(this).parents('.stack'); if ($par.length == 1) { console.log('in stack'); $par.siblings().css('z-index', '400'); }** }, stop: function() { $(this).css("cursor","default"); $(".stack").css('z-index', '500'); } }); // make the new stack droppable newStack.droppable({ tolerance: "intersect", accept: ".card", greedy: true, drop: function(event, ui) { **$(".stack").css('z-index', '500');** card = ui.draggable; putCardIntoStack(card,stackId); } });
In dragdrop-client.css
.stack { width: 300px; border: 1px dashed #ccc; background-color: #f5f5f5; margin: 10px; float:left; **z-index:500;** }
source share