I believe this is the kind of thing you are looking for:
function CheckScroll(el) {
var top_of_object = el.offset().top;
var bottom_of_window = $('.window').height();
if (bottom_of_window >= top_of_object) {
$('#result').text('ID ("'+el.attr('id')+'") is now showing');
}
}
$('.window').scroll(function(){
$('section').each(function() {
CheckScroll($(this));
});
});
EDIT:
For window scrolling: http://jsfiddle.net/bfd7w/3/
function CheckScroll(el) {
var top_of_object = el.offset().top;
var bottom_of_window = $(window).scrollTop() + $(window).height();
if (bottom_of_window >= top_of_object) {
$('#result').text('ID ("'+el.attr('id')+'") is now showing');
}
}
$(window).scroll(function(){
$('section').each(function() {
CheckScroll($(this));
});
});