My 18 month old has mucus in her eyes and they're crusted shut. Hat could cause this?

See below. Her hat would not cause this. These symptoms are normally associated with a cold. As long as the white part of her eyes are not red, just clean her eyes with a warm wash cloth.
Pink eye. Otherwise know as conjuntivitis, is usually due to a viral infection, such as a cold. Cool, moist compresses will help you clean off her eyes and soothe them some. If she gets worse, she needs to see her dr for drops because it can be caused by a bacterial infection.