Safari 5.1 broke HTML native drag and drop?

前端 未结 4 464
傲寒
傲寒 2021-02-02 13:49

Last night, I thought I\'d do a quick project to demonstrate HTML5 capabilities and to try some things out. However, I can\'t seem to figure out how to get drag and drop to work

4条回答
  •  自闭症患者
    2021-02-02 13:59

    Testing with Safari 5.1.7 Mac:

    To see the drop event fire, you have to handle the dragover event and call event.preventDefault().

    Here's the (quite entertaining) discussion where I found the answer:

    http://www.quirksmode.org/blog/archives/2009/09/the_html5_drag.html

    I don't know if this really solves the question because the asker's site (at least as of today) does this. It works fine on my machine (as do the HTML5 demo pages). But this may help someone coming to this thread with this problem who doesn't know about this rather unintuitive implementation detail.

提交回复
热议问题