How to make a draggable that has discrete positions, not continuous positions?

How to make a draggable that has discrete positions, not continuous positions?


I want to make a draggable on a grid where the draggable block
"clicks" to the nearest grid element.
Is this feasible?
All comments welcome.
Matt