make dropdown menu a drop-up menu when dropdown doesn't fit in viewport