Appearance
元素底部大于等于容器顶部并且元素顶部小于等于容器底部,则元素在容器内。
const containerRect = { top: 50, bottom: 300, } const rect = { top: 20, bottom: 200, } if (rect.bottom >= containerRect.top && rect.top <= containerRect.bottom) { // 在容器内 }