How do I end a function

I have a couple of buttons that float around my screen but I want it so that when I roll over one of them it stops so you don’t have to chase the button around. Also when you leave the button I want them to move again.