【问题标题】:How to make draggable element invisible while it reverting?如何在还原时使可拖动元素不可见?
【发布时间】:2015-09-04 12:20:06
【问题描述】:

我的 html 中有可拖动的元素。而jQuery就是这样的

$( ".block-33a" ).sortable({
      revert: true
});

$( ".hidden_drag" ).draggable({
    revert: true,
    stop: function(event,ui){
    //some code
    }
}); 

通过使用这个你可以让我的元素回到默认位置,但它在恢复时应该是无敌的。我该怎么做?

更新

这是我的小提琴http://jsfiddle.net/Q2h2w/46/

它也会说出我的要求

【问题讨论】:

  • 你有没有为此制作过小提琴?

标签: javascript jquery jquery-ui drag-and-drop


【解决方案1】:

我已经更新了小提琴。请看一看。 我添加了mouseup 事件来检测鼠标释放。希望这能解决您的目的:

http://jsfiddle.net/Q2h2w/56/

var count=0;
$('.button_area').draggable({
        revert: true,
        drag: function(){
            count++;
        },
        stop: function(event,ui){
                $('.button_area').off("mouseup");
                $(this).show();
        },
        start: function( event, ui ) {
            $('.button_area').on("mouseup",function(){
                $(this).hide();
            });
        }
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-19
    • 2011-08-02
    • 2013-06-07
    • 1970-01-01
    • 2023-04-02
    • 1970-01-01
    相关资源
    最近更新 更多