aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2011-05-07 18:23:57 -0400
committerJason A. Donenfeld <Jason@zx2c4.com>2011-05-07 18:23:57 -0400
commit7c46d8b425272ecf8d9dd102fcb454282e24b94e (patch)
tree85eb047fb13e597a2177aa19771480730d083aa4
parentScrolling, load order. (diff)
downloadPhotoFloat-7c46d8b425272ecf8d9dd102fcb454282e24b94e.tar.xz
PhotoFloat-7c46d8b425272ecf8d9dd102fcb454282e24b94e.zip
Image preloading.
-rw-r--r--web/js/010-control.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/web/js/010-control.js b/web/js/010-control.js
index c60843c..9e5c8d0 100644
--- a/web/js/010-control.js
+++ b/web/js/010-control.js
@@ -150,14 +150,19 @@ $(document).ready(function() {
.attr("alt", current_photo.name)
.attr("title", current_photo.date)
.load(function() { $(this).css("width", "auto").css("height", "100%"); });
- var nextLink = "#" + current_album_cache + "/" + cachePath(current_album.photos[
+
+ var previousPhoto = current_album.photos[
+ (current_photo_index - 1 < 0) ? (current_album.photos.length - 1) : (current_photo_index - 1)
+ ];
+ var nextPhoto = current_album.photos[
(current_photo_index + 1 >= current_album.photos.length) ? 0 : (current_photo_index + 1)
- ].name);
+ ];
+ $.preloadImages(imagePath(nextPhoto.name, current_album.path, maxSize, false), imagePath(previousPhoto.name, current_album.path, maxSize, false));
+
+ var nextLink = "#" + current_album_cache + "/" + cachePath(nextPhoto.name);
$("#next-photo").attr("href", nextLink);
$("#next").attr("href", nextLink);
- $("#back").attr("href", "#" + current_album_cache + "/" + cachePath(current_album.photos[
- (current_photo_index - 1 < 0) ? (current_album.photos.length - 1) : (current_photo_index - 1)
- ].name));
+ $("#back").attr("href", "#" + current_album_cache + "/" + cachePath(previousPhoto.name));
$("#original-link").attr("target", "_blank").attr("href", "albums/" + current_album.path + "/" + current_photo.name);
var text = "<table>";