Tunjukkan dropdown ke atas dan ke bawah

let style = 'bottom';
let element = document.getElementById('myId');
if (window.innerHeight - element.getBoundingClientRect().bottom < element.scrollHeight){
     style = 'top'
}
KingUche