This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

setDragImage

Summary

Uses the given element to update the drag feedback image, replacing any previously specified feedback image.

Method of dom/DataTransferdom/DataTransfer

Syntax

var result = element.setDragImage(element, x, y);

Parameters

element

Data-type
Object

An “img” element, used to set the drag data store bitmap to the element’s image (at its intrinsic size). If not an “img” element, used to set the drag data store bitmap to an image generated from the given element, although the mechanism for doing so is not currently specified.

x

Data-type
unsigned long

The “x” value of the drag data store hot spot coordinate.

y

Data-type
unsigned long

The “y” value of the drag data store hot spot coordinate.

Return Value

Returns an object of type

Examples

//set new drag feedback image
function setDragImage(e) {
  var img = document.getElementById("dragimg");
  var oData = e.dataTransfer;
  oData.setDragImage (img, 0, 0);
}

Related specifications

HTML5
Candidate Recommendation