Search code examples
jqueryjquery-ui-sortabledestroy

Is it possible to destroy "sortable" when "sortstart" starts?


Here is my code:

$(".myclass").bind( "sortstart", function(event, ui) 
{ 
   $('#div_1').sortable('destroy');
   $("#div_1 .li_1").droppable(
   {
      hoverClass: 'red',
      drop: function(event, ui)
      {
         $(this).addClass('red');           
      }
    });
});

Can anyone help me identify what is wrong?


Solution

  • I got it :)

    $(".myclass").bind('mousedown',function()
    { 
       $('#div_1').sortable('destroy'); 
        });
    
    $(".myclass").bind( "sortstart", function(event, ui) 
    {
       $("#div_1 .li_1").droppable(
       {
          hoverClass: 'red',
          drop: function(event, ui)
          {
             $(this).addClass('red');           
          }
        });
    });