This happens to me sometimes. I think the problem is that the charger gets wiggled out of the phone. If you unplug and replug it should keep charging. I think sometimes the connectors don't all hit and it'll get stuck with only enough voltage to keep the phone running, and not actively charging.