Зосимов,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
.bz{
height: 300px;
width: 100px;
font-size: 22px;
line-height: 44px;
color: #FFFFFF;
background-color: #8B4513;
text-align: center;
margin-top: 30px;
}
p{
height: 2000px;
}
.worked {
background-color: #FF00FF;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
$(function() {
function checkViewport(el) {
var H = document.documentElement.clientHeight,
pos = el.getBoundingClientRect();
return pos.top > 0 && pos.bottom < H
}
$(window).scroll(function() {
$('.bz:not(.worked)').each(function(indx, el) {
var visibility = checkViewport(el);
if(visibility) {$(el).addClass('worked');
// load data
}
})
})
});
</script>
</head>
<body>
<p></p>
<div class="bz" >0</div>
<div class="bz" >0</div>
<div class="bz" >0</div>
<p></p>
</body>
</html>