Help with creating a "snap to" slider

Hey everyone - I want to create a slider that controls a movie that pans a series of images, each image represented on the slider bar by a marker, the markers being about 20 pixels apart. If the user releases the handle in-between marks, I’d like slider to “snap to” the closest marker. I’d like this effect to be somewhat smooth, so if the user releases the handle and the movie is between frames 20 and 30 at frame 23, the movie would play -1 frame, check again, until it reaches 20, thus “animating” backwards instead of jumping. The x-position of the slider would also need to move x-1 until it rests on the corresponding marker.

I’ve been messing with this for a while, with some success but its still not quite there. I looked for tutorials, but couldn’t find any incorportating this feature. Any ideas? Thanks in advance!