Cramping can occur when doing hardly anything or when exercising. Cramps that occur during exercise are sometimes referred to exercise-associated muscle cramps (EAMC). The cause of these cramps are not clearly known because evidence is lacking. Most information is based off of self-reports and observational data. EAMC’s are thought to be caused by electrolyte deficiency, dehydration, or neuromuscular causes .
The theory behind the dehydration-electrolyte imbalance is that certain nerve terminals become sensitized, resulting in contracture of interstitial space which then increases mechanical pressure on motor nerve endings, producing a contracture.  So just drink more water and Gatorade, right? Not exactly. In one study, water intake matched sweat loss, but 69% of athletes still experienced cramping.
Hot vs. cold weather is interesting as well because the general population believes cramping is increased in warmer temperatures. Some research has found that cramping does occur more often in warmer weather; however, one researcher (Maughan) reported that marathoners running in 10-12 deg. C still develop cramping just as often.  Maybe the hot vs. cold idea isn’t so strong, then.
The neuromuscular theory says that muscular overload causes fatigue, leading to an imbalance between excitatory and inhibitory signals. When the muscle contracts in an already shortened position, the inhibitory signals increase (due to less tension pull on the muscle) which causes an overload of excitatory signals, leading to a cramp.  A good example of this is hamstring cramping during a bridge. Generally, cramping may occur when your feet are closer to your bum, so increasing the distance between your feet and bum (decreasing your knee angle) may reduce cramping.
The mineral deficiency idea isn’t necessarily strong. Many believe that deficiencies in minerals, such as calcium, potassium, magnesium, or sodium can cause cramping; however, the direct link between to two is actually somewhat unclear. Whether or not it is, you want to incorporate a well balanced diet into your lifestyle since it greatly affects our energy levels. Low energy leads to fatigue and an increased likelihood of injury. With any injury, you’re going to experience some sort of cramping.
 "Muscle Cramps, Charley Horse, and Muscle Spasms: Causes and Treatments." WebMD. WebMD, n.d. Web. 10 Dec. 2015.
"Creatine Supplementation during College Football Training Does Not Increase the Incidence of Cramping or Injury. N.p., n.d. Web. 14 Dec. 2015.
 Schwellnus, M. P., J. Nicol, R. Laubscher, and T. D. Noakes. "Serum Electrolyte Concentrations and Hydration Status Are Not Associated with Exercise Associated Muscle Cramping (EAMC) in Distance Runners." British Journal of Sports Medicine, n.d. Web. 14 Dec. 2015.
 Schwellnus, Martin P., Nichola Drew, and Malcolm Collins. "Increased Running Speed and Previous Cramps Rather than Dehydration or Serum Sodium Changes Predict Exercise-associated Muscle Cramping: A Prospective Cohort Study in 210 Ironman Triathletes." British Journal of Sports Medicine, n.d. Web. 14 Dec. 2015