📌  相关文章
📜  如何确定下拉菜单应显示向上或向下方向 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:01.048000             🧑  作者: Mango

代码示例1
let style = 'bottom';
let element = document.getElementById('myId');
if (window.innerHeight - element.getBoundingClientRect().bottom < element.scrollHeight){
     style = 'top'
}