desandro / draggabilly

:point_down: Make that shiz draggable
https://draggabilly.desandro.com
MIT License
3.86k stars 386 forks source link

Avoid element to be dragged and define fixed height #215

Closed rafaF closed 2 years ago

rafaF commented 3 years ago

I'm using Draggabilly and Packery to build a optimized draggable layout as shown in this Codepen: https://codepen.io/rafaF/pen/MWjvjqO

I have some doubts about how to use Packery/Draggabily.

I have been searching on the docs but I have not been able to find this info, sorry!

desandro commented 3 years ago

Hello! Thanks for reporting this issue and providing a test case.

The first one is how to convert en element "no-draggable", i.e., avoid to be dragged. I've achieved this by no initializing its Draggabilly instance

That's one way to do it

but I would like also to not be sorted when dragging others elements.

You may need to stamp the element in that case

In the other hand, I have not been able to set a fixed height on my Packery layout in order to limit how many elements fits in a column.

Packery is not designed to fixed height. It is designed to have a variable container height, so you can always add more to the bottom. In order to set a fixed height, you would need to overwrite some core Packery functionality, specifically with its packer geometry

andrewmowe-st commented 2 years ago

Hi @desandro I'm running into a similar issue regarding Draggabilly and stamped areas. Is there a way to permanently prevent draggable elements from being dropped into the stamped area? Do I need to refire the stamp method during each drag? If so, which event should I be waiting for?

Here is an example: https://codepen.io/andrewmowe/pen/Exozzpb