Firefox use HTML5 drag will automatically open the new label solution

Source: Internet
Author: User

Use HTML5 drag, but Firefox will pop up new tags, here is my humble opinion:


Previous online lookup to say use prohibit default event Event.preventdefault ();

But there are still new tags in the code.

Also query that you can set the properties of DataTransfer's SetData to other properties other than text, but I tried

Set to Text/plain or have a new tab to bounce out, but IE will complain: "Accidentally called the method or property access" set into text/html did not bounce out, the same in IE also drag and drop the error: "Accidentally called method or property access"
So say IE only know the Text property, just when I was about to give up compatibility Firefox, tried to suppress the default event globally, really realized.

Document.body.ondrop = function (event) {
        event.preventdefault ();
        Event.stoppropagation ();
    }

Attached to a net to see the pure JS write drag effect feel very good, http://rubaxa.github.io/Sortable/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.