I have app where i need only snap element to top and bottom edges of parent element. I try to find how to do it in stack but i can't find it!
Asked
Active
Viewed 231 times
2 Answers
0
el.draggable({
start: function(){
var snapped = $(this).data('draggable').snapElements;
snapped.forEach(function(el){
el.width = 1000000;
el.left = -50000;
});
}
})

Gleb Dolzikov
- 776
- 8
- 13
0
One approach is doing the snapping manually instead of relying on the draggable's functionality. E.g. you can disable the snapping and in your drag
handle implement it by changing the object's position whenever it's close enough to whatever location you like.
Here's a solution for the similar request: Getting jQuery draggable to snap to specific grid
-
As for me manual snapping it's additional pile of code, but when you need something very custom it's may be worked better... – Gleb Dolzikov Mar 29 '16 at 08:10