Drag / snap back (on a button)

hello all

been searching google for a good bit now and find all sorts of drag stuff except what i need.

what i want to achieve is this


i can do the drag stuff etc…but i need it to snap back smoothly into place.

any ideas anyone?
tutorials etc are welcome as i REALLY REALLY wanna learn.

thanks in advance