HTML5 drag and drop (Drag and drop)

Source: Internet
Author: User

First, the definition
    • drag-and-drop is a common feature that grabs an object and then drags it to another location. in HTML5, drag-and-drop is part of the standard, and any element can be dragged and dropped.
    • Internet Explorer + +, Firefox, Opera, Chrome, and Safari support drag. Safari 5.1.2 does not support dragging
Second, use
    • Set element to drag and drop: Set the Draggable property to true in order for the element to be dragged

    • Drag what: Ondragstart and SetData (), where ondragstart it specifies the data to be dragged. The SetData () method sets the data type and value of the dragged data.

    • where to put: The OnDragOver event specifies where to place the dragged data. By default, data/elements cannot be placed in other elements. If you need to set allow placement, we must block the default handling of elements.

      This is done by calling the Event.preventdefault () method of the OnDragOver event

    • To place: OnDrop A drop event occurs when the dragged data is placed.

Third, the case

HTML5 drag and drop (Drag and drop)

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.