Jump to content
GreenSock

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

Draggable

.update()

.update( applyBounds:Boolean, sticky:Boolean ) : Draggable

Updates the Draggable's x/y properties to reflect the target element's current position.

Parameters

applyBounds: Boolean

(default = false) — if true, the Draggable’s applyBounds() method will be called as well so that bounds are enforced (this takes more processing, though).

sticky: Boolean

If true, the coordinates will be updated so that the Draggable "sticks" to the pointer which can be very helpful when reparenting an element. Otherwise, the element's positioning would naturally change when being nested into a different element.

Returns : Draggable

the Draggable instance itself (to make chaining possible)

Details

Updates the Draggable's x and y properties to reflect the target element's current position. This can be useful if, for example, you manually change or tween the element's position, but then you want to make sure the Draggable's x and y reflect those changes. You could even point a tween'sonUpdate to the Draggable's update method to ensure things are synchronized throughout a tween. Setting sticky to true can be helpful if you're re-parenting the target because it acts like it "sticks" to the pointer (otherwise, reparenting would naturally cause the position to change). 

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