/* favor current image, if user clicked on `last' or something */
load(current);
- for (i = 0; i < images.length; i++) {
- /* don't blindly preload all images at the beginning,
- * but rather load them one by one, in order to get
- * next ones faster
- */
+ /* don't blindly preload all images at the beginning,
+ * but rather load them one by one, in order to get
+ * next ones faster, beginning with next to current
+ */
+ for (i = current + 1; i < images.length; i++) {
+ if (load(i) == 0) {
+ setTimeout("preload()", 500);
+ return;
+ }
+ }
+ for (i = 0; i < current; i++) {
if (load(i) == 0) {
setTimeout("preload()", 500);
return;