скорей всего не лучший вариант
<style>
div {
height: 200px;
}
</style>
<div class="op" style="background: red"></div>
<div class="op" style="background: green"></div>
<div class="op" style="background: blue"></div>
<div class="op" style="background: red"></div>
<div class="op" style="background: green"></div>
<div class="op" style="background: blue"></div>
<script>
window.onload = function () {
if (!document.getElementsByClassName) {
document.getElementsByClassName = function (className) {
var elems = document.getElementsByTagName('*');
var len = elems.length;
var mas = [];
for (var i = 0; i < len; i++) {
if (elems[i].className == className) {
mas.push(elems[i]);
}
}
return mas;
}
}
var elems = document.getElementsByClassName('op');
var len = elems.length;
var h;
window.onscroll = function () {
for (var i = 0; i < len; i++) {
h = parseInt(elems[i].getBoundingClientRect().bottom);
if (h < 0) {
h = 0;
}
elems[i].style.opacity = h/200;
elems[i].style.filter = 'alpha(opacity=' + h/2 + ')';
}
}
}
</script>