I am currently using the following JavaScript function to detect whether an element is scrolled into view:
function isScrolledIntoView(elem) {
var docViewTop = $(window).scrollTop();
var docViewBottom = docViewTop + $(window).height();
var elemTop = $(elem).offset().top;
return ((elemTop <= docViewBottom) && (elemTop >= docViewTop));
}
Now, I need to distinguish whether this element was autoscrolled on page load (e.g. via #anchor-tag) or manually scrolled into view.
What is a good way of doing this?