Jump to content

JQuery UI ! Draggable image and revertion

- - - - -

  • Please log in to reply
No replies to this topic

#1
Stasonix

Stasonix

    Learning Programmer

  • Members
  • PipPipPip
  • 82 posts
  • Programming Language:C++, PHP, JavaScript, Delphi/Object Pascal, Pascal
  • Learning:C++, PHP, JavaScript, Delphi/Object Pascal
I have 4 droppable blocks and 1 draggable image, how to achive effect of revertion, only if the I dropped my image not into droppable element? I used this options, but can't reach wished result:

$('.myimage').draggable({

   scope: "tasks",

   revert: true,

   revertDuration: 1,

   stop: function(event, ui) {    }

  });


  $('.keeper').droppable({

     accept: ".card",

     scope: "tasks",

     tolerance: "fit",

     greedy: true,

     drop: function(event, ui) {

        $(this).css("background-color","green");

        //$('.card').draggable({ scope: "tasks", revert: false });

       }

   });

so as you can see the revert set to "true", and when I dropped image not into .keeper, I have the revertion effect, and it's works fine untill I'm not drop .myimage to .keeper, after that I can dropping .myimage to everywhere on the page (revert doesn't work anymore), but I'm still need that .myimage was with this feature as for non-.keeper class elements, I hope you understand what I want.

a string what I've commented it's a wrong way I think.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users