jQuery UI:Droppable('drop'event,tolerance:touch)bug在safari(mac) [英] jQuery UI: Droppable ('drop' event, tolerance: touch ) bug in safari (mac)

查看:213
本文介绍了jQuery UI:Droppable('drop'event,tolerance:touch)bug在safari(mac)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法解决以下问题:


以下代码适用于所有浏览器的 mac 以及窗口,除了它
部分在macs safari(5.1.5)上。

The below code works in all browsers of mac as well as windows, except that it works partially on macs safari(5.1.5).

注意:它适用于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)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆