I have some javascript that can appear on many different pages. Sometimes those pages have been accessed via a URL containing an anchor reference (#comment-100, for instance).
To detect when the element appears on the screen, use the appear plugin:
$('#comment-1').appear(function() { $(this).text('scrolled'); });