Is html5 drag and drop broken on safari browser for windows?

断了今生、忘了曾经 提交于 2019-11-30 09:02:31

问题


Is html5 drag and drop broken on safari browser for windows ? If so, are there any work arounds ?

I'm using Safari 5.1.2 on Windows 7 and the drop targets always show up as non droppable. Tried this on 2 different windows 7 computers with clean install and latest setup.

Tried with both this demo and my own code which works on every other latest browser.

http://html5demos.com/drag


回答1:


Indeed D&D for Safari doesn't work.

Kind of work around for Safari:

Put the logic in the 'dragend' event of the draggable object
Instead in the 'drop' event of the dropping on object.




回答2:


Yes. After a lot of self-doubt, experimentation, and research, I can say that it is definitely broken for me too (Safari 5.1.7 on Windows) as at today: 15 Nov 2012. This has been quite confusing and distressing!

Hope Apple comes to the party soon.




回答3:


From http://html5doctor.com/native-drag-and-drop/#dragging_anything
add this:

[draggable=true] {
  -khtml-user-drag: element;
}

Non-HTML5 drag and drop is available via jQuery UI: http://jqueryui.com/demos/draggable/

You can build a download with only that specific function if you want it to be lightweight.

You can use Modernizr to detect whether it's supported and fall back on jQuery if needbe:

if (Modernizr.draganddrop) {
  // Browser supports HTML5 DnD.
} else {
  // Fallback to a library solution.
}

From http://www.html5rocks.com/en/tutorials/dnd/basics/



来源:https://stackoverflow.com/questions/9671989/is-html5-drag-and-drop-broken-on-safari-browser-for-windows

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