example of my own here, make sure you use doctype otherwise $(window).height() returns document height
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(window).scroll(function(){
if(($('.diff').offset().top+$('.diff').height()) < ($(window).scrollTop() + $(window).height()))
{
$('.diff').addClass('green');
}
});
});
</script>
<style>
.green { background:#0F0 !important; }
</style>
</head>
<body>
<div style="min-height:250px; margin-bottom:10px; background:#F00;">1</div>
<div style="min-height:250px; margin-bottom:10px; background:#F00;">2</div>
<div style="min-height:250px; margin-bottom:10px; background:#F00;">3</div>
<div style="min-height:250px; margin-bottom:10px; background:#F00;">4</div>
<div class="diff" style="min-height:250px; margin-bottom:10px; background:#00F;">THIS ONE</div>
<div style="min-height:250px; margin-bottom:10px; background:#F00;">1</div>
<div style="min-height:250px; margin-bottom:10px; background:#F00;">1</div>
<div style="min-height:250px; margin-bottom:10px; background:#F00;">1</div>
</body>
</html>
scroll slowly and you should see that as soon as you are passed the blue div it changes to green
hope it helps
tomhre