javascript - How to *continuously* detect if a page is fully loaded with JS? -
there tons of ways detect if page loaded. want continuously , couldn't find way working.
to explain continuously mean, let me give example. in page,
user clicks somewhere , request new image loaded. triggers buffering of images.
js code automatically buffers images continuously.
so want check if in page there no image left loaded (also, there no image in process of downloading).
[i want able understand if every image finished being downloaded/buffered/cached. can request buffering of new images.]
i plan thing in brackets infinite times while limiting number of buffered images.
here can sample relevant code: https://stackoverflow.com/questions/35650853/how-to-buffer-next-200-images-when-the-page-is-not-loading-anything
check if document loaded:
$( document ).ready(function() { //your code goes here. });
check if images loaded:
$('img').each(function(i, e){ var img = new image(); img.onload = function() { console.log($(e).attr('src') + ' - loaded!'); $(e).attr('loaded', true); } img.src = $(e).attr('src'); });
Comments
Post a Comment