Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...

Draggable.get()

Draggable.get( target:Object ) : Draggable

[static] Provides an easy way to get the Draggable instance that's associated with a particular DOM element.

Parameters

target: Object

the target DOM element whose Draggable instance you want to retrieve; this can be either the element itself, or a selector string like "#myElement" or a jQuery object.

Returns : Draggable

the Draggable instance that’s associated with the target element (or undefined if none exists)

Details

Provides an easy way to get the Draggable instance that's associated with a particular DOM element. For example, maybe you made all of the elements with the class ".draggable" draggable by calling Draggable.create(".draggable") and then you want to find the individual Draggable instance that's associated with the element with an ID of "#element1"; that'd be as simple as:

var draggable = Draggable.get("#element1"); //or use the element itself instead of a selector string: var myElement = document.getElementById("element1"); var draggable = Draggable.get(myElement);

Copyright 2017, GreenSock. All rights reserved. This work is subject to theterms of useor for Club GreenSock members, the software agreement that was issued with the membership.
×