desandro / draggabilly

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

Snapping + Resistance #168

Closed neslho closed 6 years ago

neslho commented 7 years ago

Have you considered adding functionality for increasing resistance when dragging and/or snapping? I built this demo up for my own purposes: https://codepen.io/danohlsen/pen/gxgMVg. I originally set out to find a draggable plugin that could accommodate INCREASING resistance while dragging. I did this using Unidragger by snapping it to points but I could see a version where resistance increases the closer the element gets to the edges of the containment element.

desandro commented 7 years ago

Hello! Thanks for reporting this issue.

This is a great demo! Flickity has similar behavior. You can drag, but after releasing the position of the element is attracted towards a target.

For this kind of behavior, I feel its better suited as a separate library. I recommend building off of Unidragger, Draggabilly & Flickity's lower-level class, rather than Draggabilly itself. Unidragger has just the mouse/touch events so you can start from there and not get caught up with Draggabilly's logic.