Geckos can't tell that theres a glass barrier keeping them from going to the place they want to go. So your gecko doesn't understand that he can't go through the glass, so hes going to keep trying. The best way to stop this is to cover the sides(or wherever hes trying to get through) with construction paper, or some sort of background.