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

↘锁芯ラ 提交于 2019-12-10 16:26:31

问题


I am not able to solve the following problem:

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

Note: It works on windows safari(5.1.5).

This is the basic structure:

$(".div2" ).droppable({
        accept: '.div1',
        tolerance: 'touch',
        drop: function(){ 
                        alert('dropped');
        }   
});

So, basically when div1 touches div2 , drop event should be triggered.

But the above case does not trigger the drop event.

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??

Versions used:

jQuery: 1.7.2
jQuery UI: 1.8.18
Safari(mac): 5.1.5

update:

I tried other options of tolerance. Both 'touch' and 'intersect' do not work as desired. But 'pointer' works perfectly fine.

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.

Any help will be appreciated.

Thanks!


回答1:


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.



来源:https://stackoverflow.com/questions/10104732/jquery-ui-droppable-drop-event-tolerance-touch-bug-in-safari-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!