The vertical jump involves coordinated spine, hip, knee, and ankle extension to produce force in a vertical direction very quickly, while the muscles are shortening through to a very short muscle length. Since the time available for producing force is long compared to other athletic movements, this reduces the importance of rate of force development. Yet, the force-velocity relationship is the primary determinant of the amount of force that can be exerted at a given movement speed. Therefore, maximum force, velocity, and the force-velocity gradient all affect vertical jump height.

“Put in the work. It’s muscle memory, first and foremost. Training­wise, people say, ‘You gotta do this, you gotta do that.’ I didn’t believe in that. I never worked on my legs in high school or middle school. I would just go through this routine over and over and over, visualizing that day when you dunk on the court. And then you live in that moment.”
Start on a lower hoop and practice on that, just to get the feel of dunking. Jump height is one thing, but you would be surprised at the number of people that find it hard just to slam the ball into the basket, even if they are high enough. Make sure the hoop is high enough for you to only touch the rim. Different jumping styles and distances from the basket can change your vertical drastically and could be the difference between a rim-block and a slam. Keep progressing and eventually you will see results. Good luck!
An alley-oop dunk, as it is colloquially known, is performed when a pass is caught in the air and then dunked. The application of an alley-oop to a slam dunk occurs in both games and contests. In games, when only fractions of a second remain on the game or shot clock, an alley-oop may be attempted on in-bound pass because neither clock resumes counting down until an in-bounds player touches the ball. The images to the right depict an interval spanning 1/5 of a second.

I just turned 14 year old 5''10-5''11 8th grade 160-70 poundsand i''m wondering what stretching exercises and weight lifting exercises i can do to increase my vertical its already at like 30-32 inches but i want maybe a 40 by high school ive dunked maybe over 10 times with one hand it effortless to touch rim with both feet and easier with one but i''''''''m also wondering how to take of when i dunk because i stutter step and i want to get my explosiveness up. Can anyone help me?

At the competitive level (i.e., the NFL and NBA combines), vertical leap is measured using a “jump tester”—a tripod with a series of thin plastic sticks one inch apart. If you have access to this equipment, it’s your best bet for getting an accurate measurement. A cheaper, more feasible option is to do your jump next to a wall and mark the highest point you touch with a piece of chalk.
Vertical jumps are used to both train and test for power output in athletes. Plyometrics are particularly effective in training for power output, and include vertical jumps of different types in their protocol. In one recent study, training with plyometrics (which included continuous vertical jumps) was shown to improve jump height and boost vertical jump performance to similar degrees in combination with very different resistance training protocols, indicating that the plyometric jumping contributed to the increased jump height more than resistance training. Research into plyometric jumps found vertical jumps to be among the highest in terms of muscle recruitment (as measured by electromyography), power output, and ground reaction force produced.[8][9][10] Fatigue has been researched in athletes for its effect on vertical jump performance, and found to decrease it in basketball players, tennis players, cyclists, rugby players, and healthy adults of both genders.[11][12][13]