I tried to design a dropdown component.
So far I faced an issue that the dropdown list is too long, so I keen to display it as the upward direction. I know Bootstrap has the same feature, but I want to do it my own. Any suggestions or keywords?
Thank you
UPDATE:
I don't use any library. Just refer the Bootstrap has achieved the purpose.
These pictures are just examples
Here is what Bootstrap did, they were checking if the dropdown-menu height is less than the rest of the screen. Below is what I did.
let style = 'bottom';
let element = document.getElementById('myId');
if (window.innerHeight - element.getBoundingClientRect().bottom < element.scrollHeight){
style = 'top'
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With