-1

I have a drop-down that is in the middle of the document. When the drop-down shows up on the bottom of the screen, I want the drop-down to go up instead of down. When the drop-down shows up on the top of the screen, I want the drop-down to go down.

The drop-down is designed in HTML/CSS. I need the Javascript/jQuery code to make this work.

Any help will be much appreciated.

Thank you! –

1 Answers1

0

First You have to find Top and Left coordinates of drop-down component. let coordibnates are x1,y1. Then find width and height of screen via screenX and screenY. then you can compare x1,y1 with screenX and screenY respectively.

you can do like this

Community
  • 1
  • 1
SilentBomb
  • 168
  • 2
  • 11