Something like the following:
var id = window.location.hash;
var divFromTop = $(id).offset().top,
divFromBottom = divFromTop + $(id).height();
if (distanceFromTop >= divFromTop && !(distanceFromBottom > divFromBottom)) {
$(id.replace("#", ".") + "-info").fadeIn(300);
} else {
$(id.replace("#", ".") + "-info").fadeOut(300);
}
You could probably make this a little more readable but the basic idea is that you use the document location hash to identify the necessary elements.