Is there an Event triggered when the User "sees" a certain Element?
Is there an Event triggered when the User "sees" a certain Element?
The case is: i want to execute an function when the user is scrolling down and reaching a certain point/element. At the moment I'm doing so by using scroll and the position of the element:
-
$(window).scroll(function(event) {
if($(window).scrollTop() > ($('#element').offset().top - 800) && 'true' != activeautoload){
activeautoload = 'true';
function_load(5);
-
}
-
});
But i'm not a 100% percent on this since the offset().top seems to vary from the scrollTop for reasons i don't completly understand so far. Is there a better Way then using the position and if not is there a better way using the position?