0

我已经实现了拖放

<div class=\"customNote\" id=\"customNote\" draggable=\"true\" ondragstart=\"moveNote($(this));\" ondblclick=\"showNoteText($(this));\" title=\"Öffne Notitz\"></div>

在函数 moveNote 中:

$('.document').bind("mouseup.note",function(event) {
//do something
$('.document').unbind("mouseup.note");
}

这可以在 chrome 和 firefox 中找到,但 IE 不会抛出 mouseup 事件。相反,它正在等待另一个鼠标按下。

当我使用 onmousedown 并绑定到 mousemove 时,它​​适用于 IE。但后来我不能再使用我的 ondblclick 了。我试图用 setTimeout 找到点击次数,但它只响应第一次点击。

ondragstart 和绑定到 dragstop 不起作用。那时它永远不会下降(也不会在 chrome 和 firefox 中)。

如果是“div”,我也尝试了“a href=#”,但没有帮助。

你有什么想法可以解决这个问题吗?onmouseup 和他仍然可以识别双击或使用 ondragstart 的 dragstop/mouseup 的解决方案。

4

1 回答 1

0

Folgende Lösung hat funktioniert statt ondragstart und dragend

$('.customNote').draggable( {
                    cursor: 'move',
                    helper: 'original',
                    containment: '.document',
                    stop: handleDragStop,
                    revert: 'false'
                  } );

function handleDragStop( event, ui ) {
//do something
}
于 2016-05-23T11:42:24.593 回答