Revue Draggable ๐Ÿค

Make anything draggable!

Active:

Event: {}

๐ŸŽฎ Quickstart

I don't use any options. Just Plug and Play fun!

๐Ÿ”’ X-axis

I can only be dragged horizontally (x-axis).

๐Ÿ”’ Y-axis

I can only be dragged vertically (y-axis).

โŒ Undraggable

I don't want to be dragged until my update options is set to a non-false value. Click on me to toggle draggability.

๐Ÿ–ฒ Tracking

I track my deltas. Useful if you need to know my position!

x: 0, y: 0

โœ‹ Handle

I can only be dragged by my handle. I use querySelector under the hood.

Drag here

๐Ÿ–ผ Bounds

I can only be moved withing the confines of the body element.

๐Ÿคธโ€โ™€๏ธ Scrollable content

Drag here
I have long scrollable content and a handle โœ‹. x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x

๐Ÿ‘Ž Non-draggable handle

Can't drag here
Dragging here works

๐Ÿงฉ Grid

I snap to a 25 x 25 grid

๐Ÿงฉ Grid

I snap to a 50 x 50 grid

๐Ÿˆ Drag and Drop

I can detect drops from the other Drag and Drop box.

๐Ÿˆ Drag and Drop

I can be dropped onto the other Drag and Drop box.

๐Ÿงช Programmatic usage

I sync my state with a dragHandler.

๐Ÿงช Programmatic usage

I have a dragStop handler to sync state.

๐ŸŽจ Styling

I already have an absolute position.

๐Ÿ“” Default position

I have a default position of { x: 25, y: 25 }, so I'm slightly offset.

๐ŸŒ๏ธโ€โ™€๏ธ Offset

I have a default position based on percents { x: '-10%', y: '-10%' }, so I'm slightly offset.

๐Ÿช„ Rem or Px positioning

I use rem instead of px for my transforms. I also have absolute positioning. I depend on a CSS hack to avoid double absolute positioning.

๐Ÿฅ Nested

I' m in a nested component!

๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘ง Parent boundaries

I can only be moved within my offsetParent. Both parent padding and child margin work properly.

๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘ง Parent boundaries

I'm stuck in here too...