Jump to content
GreenSock

DraggablePlugin

.startDrag()

.startDrag( event:Object ) : void

Forces the Draggable to begin dragging.

Parameters

event: Object

The mouse or touch event.

Details

This is rarely used, but you may force the Draggable to begin dragging by calling startDrag() and passing it the original mouse/touch/pointer event that initiated things - this is necessary because Draggable must inspect that event for various information like pageX, pageY, target, etc. You cannot call startDrag() without passing that original event.

startDrag() is different than enable() in that enable() activates the Draggable instance so that it responds to user interaction whereas startDrag() actually begins dragging the element, as if the user clicked on it and started dragging.

A great place to learn more about working with mouse/touch/pointer events is this article.

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.
×