Wednesday, 8 November 2017

The DragEvent and DataTransfer Interface in HTML5

DragEvent interface is used to create objects of the DataTransfer interface and initialize the dragging operation. It provides the dataTransfer attribute and initDragEvent() method for this purpose. The dataTransfer attribute of the DragEvent interface returns an object of the DataTransfer interface. The initDragEvent() method initializes an event to drag the data. The DataTransfer interface provides various attributes and methods.

  • dataTransfer.dropEffect[=value] :- Specifies an attribute to set an operation when the data is dropped. the possible values are none, copy, link, and move.
  • dataTransfer.effectAllowed[=value]:- Specifies an attribute to set the kinds of operations that are to be allowed. The possible values are none, copy, copyLink, copyMove, linkMove, move all, and uninitialized.
  • dataTransfer.items :- Specifies an attribute that returns the drag data with a DatatransferItems object.
  • dataTransfer.setDragImage(element, x, y):- Specifies an method that sets a dragged image to a specified element and replaces the dragged purpose.
  • dataTransfer.addElement(element):-Specifies a method that adds an element to the list of elements used for the dragging purpose.
  • dataTransfer.types:- Specifies an attribute that returns a list of formats that are set to specify the types of dragged data.
  • data=dataTranfer.getData(format):- Specifies a method that returns the specified data.
  • dataTransfer.setData(format,data):-Specifies a method That sets the specified data.
  • dataTransfer.clearData([format]):-Specifies a method that removes data of the specified formats.
  • dataTransfer.files:- Specifies an attribute that return list of all the files that are being dragged.

No comments:

Post a Comment