Mouse follow with inertia

i’ve seen this a million times,
i just can’t think of any examples off the top of my head.

I’m trying to do this.

i want it so that the object that follows my mouse is on a track,
so that it only moves up and down according to the y-coordinates of my cursor.

i hope that made sense.
anybody know where i can find a tutorial for that?
thanks people.