问题描述
我无法解决以下问题:
注意:它适用于Windows safari(5.1.5)。
Note: It works on windows safari(5.1.5).
这是基本结构:
$(".div2" ).droppable({
accept: '.div1',
tolerance: 'touch',
drop: function(){
alert('dropped');
}
});
所以,基本上当 div1 触摸 div2 应该触发掉事件。
So, basically when div1 touches div2 , drop event should be triggered.
但是上述情况不会触发drop事件。
But the above case does not trigger the drop event.
触发Mac中的drop事件的唯一情况(如下所示) safari是当draggable div div1 完全通过droppable div div2 。我只是不知道为什么??
The only case (shown below) that triggers the drop event in macs safari is when the draggable div div1 completely passes the droppable div div2. i just dont know why??
jQuery: 1.7.2
jQuery UI: 1.8.18
Safari(mac): 5.1.5
更新:
我尝试过其他宽容选项。 触摸和相交'do
无法正常工作。但是'指针'完全正常。
I tried other options of tolerance. Both 'touch' and 'intersect' do not work as desired. But 'pointer' works perfectly fine.
有没有其他方法可以实现容忍:触摸的功能?我正在考虑检测2个div之间的冲突,然后应用相应的逻辑。
Is there any other way i could achieve the functionality of 'tolerance:touch'? I am thinking of detecting collision between 2 divs and then apply the corresponding logic.
任何帮助将不胜感激。
谢谢!
推荐答案
尝试添加 position:absolute! ;
到元素。这是我发现这个问题的解决方案。否则,您可以尝试为draggable / droppable div创建一个父div。
Try add position: absolute !important;
to the element. That's the solution I found to this problem. Otherwise you can try create a parent div for the draggable / droppable div.
这篇关于jQuery UI:Droppable('drop'event,tolerance:touch)bug在safari(mac)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!