0

How to add smooth or animate for jquery drag & drop?

Here's my code:

<!-- Drag and Drop -->  
     $("#sortable-left, #sortable-right").sortable({
         connectWith: ".connectedSortable",
         receive: function(e,ui){
         }
     });

     $("#sortable-right").on("click", "li a", function (){       
         $(this).closest('li').remove();        
     });

    $("#sortable-right").on("click", ".drop-close", function(){
        $("ul#sortable-left").append('<li class="ui-state-default ui-sortable-handle"> <strong>'+$(this).parents("li").find("strong").text()+'</strong><div class="ui-plus-desc"> <a class="drop-close" data-toggle="tooltip" data-original-title="Remove">                                                        <i class="fa fa-times"></i></a><span>at 11:47, 21 June 2014</span><span>by Mark Antany</span></div></li>');
    });
    <!-- Drag and Drop -->
SamLosAngeles
  • 2,660
  • 2
  • 14
  • 12

1 Answers1

0

I am not sure but the below might work
When you click on the item to be dropped make its position:fixed and then ondrag change its position offset to the mouse pointers position

wallop
  • 2,510
  • 1
  • 22
  • 39
  • no. my drag and drop is working fine. i need just animate for drag-able. is this posssible? – Naresh UI Designer Jul 21 '14 at 10:33
  • i am talking about animate itself.
    From your question i understand when your drag and drop you want the dragged item to smoothly follow the mouse? If that is the case will what i have told above work?
    Changing the position:fixed does not make it bound to the common flow and changing its offset to the mouse pointers position will make the draggable item to move to the location where the mouse pointer is. On drop when you change the item position and insert it into drop container, it should look fine
    – wallop Jul 21 '14 at 11:14