Open the dropdown above or below according to the available place