如何定位绿色框,以便在使用 jQuery 滚动超过其高度时,框的底部与可用空间的底部对齐。
<div class="content">
<div class="left">
</div>
<div class="right">
</div>
</div>
.content { width: 400px; position: relative; height: 200px; overflow-y: auto; overflow-x: hidden; border: 1px solid gray; }
.left { position: absolute; left: 0; width: 200px; background: red; height: 400px; }
.right { position: absolute; right: 0; width: 200px; height: 100px; background: green; }
$('.content').scroll(function(){
//how to position green box so the bottom of the box
//is aligned to bottom of space available
});