diff options
Diffstat (limited to 'phpfspot.js')
-rw-r--r-- | phpfspot.js | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/phpfspot.js b/phpfspot.js index 89eacba..f9f9703 100644 --- a/phpfspot.js +++ b/phpfspot.js @@ -427,23 +427,32 @@ function WSR_getElementsByClassName(oElm, strTagName, oClassNames){ } -function preloadPhotos(lbImg) { +function preloadPhotos(image_url) { - var d=document; - if(d.images) - if(!d.photos) - d.photos=new Array(); - - var i, j=d.photos.length; + var i; + var timeout = 1000; + var waiting = 100; + var counting; lbImg=WSR_getElementsByClassName(document,"img","thumb"); for(i=0;i<lbImg.length;i++){ - d.photos[j]=new Image; - d.photos[j].src=lbImg[i].src; - j++; + lbImg[i].src=image_url[i]; + // to not bomb the server with requests, give the page some time + // to load the images one by one. if a image exceeds the timeout, + // the next image will be loaded. + if(lbImg[i].complete != undefined && lbImg[i].complete != true) { + counting = 0; + while(lbImg[i].complete != true && counting < timeout) { + window.setTimeout("noop()", waiting); + counting+=waiting; + } + } } } +/* a function that does nothing */ +function noop() {} + function startSlideShow() { if(!sliding) { |