This is the most common phobia among people, the fear of heights. It's called acrophobia.
A study conducted by the Royal Society, the test to estimate the level of acrophobia, participants were made to stand at ground level and judge the height of a building and then from the top of the same building.
The ones who were most afraid judged the building to be much taller than the rest. The acrophobics seem to see the building taller, which evokes the fear.