views:

50

answers:

1

I have a problem where the element calls .show() when the draggable triggers drag, does not let me drop into the droppable. How can I fix this?

$(document).ready(function() {
$(".folder").droppable({
        greedy: true,
        drop: function(event, ui) {
            $(".folder").hide();
        },
        tolerance: 'touch'
    });

$(".folder").hide();
$(".draggable_folder").draggable({ 
    cursor: 'move',
    cursorAt: { top: 8, left: 0 },
    drag: function(event, ui) {
        $(".folder").show();
    },
    helper: function(event) {
        var subject = $(this).find('.message_subject').html();
        return $('<div class="ui-widget-header" style="max-width: 100px;">'+subject+'</div>');
    }
});
});

<ul>
    <li class="folder">{$folders[f_list].name}</a><div style="clear:both"></div></li>
</ul>
<table>
    <tr class="draggable_folder"><td>test</td></tr>
</table>
+1  A: 

In $(".draggable_folder").draggable, change drag: function(event, ui) to start: function(). This will make .folder visible and the droppable will become active. The final code for draggable:

$(".draggable_folder").draggable({ 
  cursor: 'move',
  cursorAt: { top: 8, left: 0 },
  start: function() {
    $(".folder").show();
  },
  helper: function(event) {
    var subject = $(this).find('.message_subject').html();
    return $('<div class="ui-widget-header" style="max-width: 100px;">'+subject+'</div>');
  }
});
Gert G
Thank you, worked perfectly!
tpae
Good stuff and no problem. :)
Gert G