Can you use a polymorphing creature/object to gain altitude?

If my character is on top of or holding (not necessarily grappling) on to a creature or object when it undergoes a polymorph effect to turn into something much larger like an elephant or a large tree, could my character remain on top of, or holding on to the top of, that polymorphed creature or object?