HTML5 Drag and drop (drag and Drog)

Source: Internet
Author: User

Drag-and-drop (drag and Drog) is a standard part of HTML5, and is a common feature, meaning to grab an element into a different location, any element in the HTML5 can be dragged and dropped, the title is to be related to the settings.

1. Set the element to be drag-and-drop, that is, set the Drapgable property to True

2, drag what-ondragstart and SetData (), specify what happens when the element is dragged?

(1): The Ondragstart property invokes a function drag (event), which specifies the data being dragged.

(2):d Atatransfer.setdata () method sets the data type and value of the dragged data

Funcation drag (EV) {

Ev.dataTransfer.setData ("Text", ev.target.id);

The data type is: "Text", the value is the ID of the draggable element

}

HTML5 Drag and drop (drag and Drog)

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.