【问题标题】:jQuery Droppable Ignores DropsjQuery Droppable 忽略丢弃
【发布时间】:2012-04-12 18:27:58
【问题描述】:

当您将鼠标按下概述的单词时,会出现一个小的上下文菜单。拖动您想要的选择,然后释放。在当前配置中,它就像用户没有选择一样。如果我将 droppable 从 #del 更改为 #target,那么它可以工作,但显然你不能选择这种方式。

$(function() {
    $('#word').mousedown(function(ev, ui) {
        $("#target").slideDown(100);
    });    
    $('#word').mouseup(function(ev, ui) {
        $("#target").slideUp(100);
    });    
    $('#word').draggable({
        axis: 'y',
        containment: 'parent',
        revert: true, revertDuration: 100,
        stop: function() {
            $("#target").slideUp(100);
        }
    });
    $('#del').droppable({
        activeClass: 'over',
        drop: function() {
            var vote = alert("Delete action goes here");
        }
    });
});​

看看小提琴:http://jsfiddle.net/monsto/PF3ty/7/

我错过了什么?

【问题讨论】:

    标签: jquery draggable droppable


    【解决方案1】:

    想通了……

    简单地说,draggablestop 参数阻碍了droppabledrop。它在删除 stop 定义并将这些操作放入 drop 定义中后起作用。

    【讨论】:

      猜你喜欢
      • 2011-02-27
      • 1970-01-01
      • 2018-12-15
      • 2017-10-08
      • 1970-01-01
      • 2013-04-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多