jquery - How can I force stop a JavaScript image preloading sequence (preloader by Ariel Flesler)? -


say have button on web page. whenever buttons clicked, content (a whole list of image files can go 5mb) pre-loaded asynchronously , added web page when loading complete.

but makes sense stop pre-loading procedure if button clicked again before first pre-loading procedure finish, , start second. how can achieve forced stop?

by way, i'm using ariel flesler's jquery based image preloader .

thanks in advance!

it's werid code there 2 places images kept img variable , $preload.cache array.

you can add

settings.control(function() {     imgs = null;     $preload.cache = []; }); 

it can after lines

  var imgs = $(array(settings.threshold+1).join('<img/>'))          .load(handler).error(handler).bind('abort',handler).each(fetch); 

and can pass function abort

var _abort = null; $('<your button>').click(function() {     if (_abort) {         _abort();     }     $.preload( '#images img', {             placeholder:'placeholder.jpg',             notfound:'notfound.jpg'             control: function(abort) {                     _abort = abort;             }     }); }); 

it should work i'm not sure if will.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -