This is my code (please see http://jsfiddle.net/VCfSc/1/):
$('.first').draggable({
cancel: null,
helper: 'clone'
});
$('.second').droppable({
over: function(event, ui) {
$(this).css('z-index', 1);
ui.helper.css('z-index', 0);
}
});
I am trying to have the helper clone go under the droppable element when it is dragged over it. What am I doing wrong?
When you drag the
.firstelement, the generated draggable element is positioned absolutely and added after the.secondelement. An absolutely positioned element gets a higher precedence. To fix this, useui.helper.css('z-index', "-1");instead ofui.helper.css('z-index', 0);.