开发者

jquery drag and drop animation

开发者 https://www.devze.com 2022-12-31 06:02 出处:网络
I have some UI functionality for drag and drop, but when an element is dropped, the animation makes it flit about all over the place for a split second before it appears in the newly dropped location.

I have some UI functionality for drag and drop, but when an element is dropped, the animation makes it flit about all over the place for a split second before it appears in the newly dropped location.

Can anyone advise how to tackle this, so that the dra开发者_StackOverflowggable element moves more cleanly into place on success?

Here is a snippet from the ajax call on successful drop:

...
success : function() {
      $(ui.draggable)
        .parent()
        .droppable("enable")
        .end()
        .appendTo(droppable)
        .parent()
        .droppable("disable");
    },
...


not tested but something like this

success : function() {
      $(ui.draggable)
        .parent().hide().droppable("option", "disabled", false)
        .end()
        .appendTo(droppable).show()
        .droppable("option", "disabled", true);
    },

anyway you can also unbind the animation while the element is moving! but i don't know the rest of the code!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号