, , Javascript, , , -. , - .
:
<div class="complex-height">
<div class="top"></div>
<div class="middle"></div>
<div class="bottom"></div>
</div>
CSS
.complex-height {
position: fixed;
top: 0;
left: 0;
max-height: 100%;
width: 300px;
overflow: auto;
}
.complex-height .top, .complex-height .bottom {
width: 100%;
position: absolute;
z-index: 2;
}
.complex-height .top {
top: 0;
}
.complex-height .bottom {
bottom: 0;
}
Javascript ( Prototype, ):
$$('.complex-height .middle').each(function(middle) {
middle.setStyle({
paddingTop: middle.up('.complex-height').down('.top').getHeight() + 'px',
paddingBottom: middle.up('.complex-height').down('.bottom').getHeight() + 'px'
});
});
$$('.complex-height').invoke('observe', 'scroll', function(e) {
this.down('.top').setStyle({
top: this.scrollTop + 'px'
});
this.down('.bottom').setStyle({
bottom: (0 - this.scrollTop) + 'px'
});
});