Capítulo 192 de 411

Chapter 192: Draggable.applyBounds()

Core Idea

Applies new drag bounds to an already-created Draggable instance, replacing whatever bounds it had before.

Reference Tables

ParameterTypeDescription
boundsElement | String | Objectcontainer element/selector, {top,left,width,height} rect, {minX,maxX,minY,maxY}, or {minRotation,maxRotation}

Code Examples

draggableInstance.applyBounds("#container");
draggableInstance.applyBounds({ minX: 10, maxX: 300, minY: 50, maxY: 500 });

Key Takeaways

  1. Useful for updating bounds dynamically (e.g. after a resize) without recreating the Draggable.

Connects To

  • Draggable bounds (vars): the same option set at creation time via Draggable.create(target, {bounds: ...}).