r2568 - photoviewer: experimental preloader
Author: joern.zaefferer
Date: Thu May 14 01:43:00 2009
New Revision: 2568
Modified:
branches/photoviewer/ui/ui.photoviewer.js
Log:
photoviewer: experimental preloader
Modified: branches/photoviewer/ui/ui.photoviewer.js
==============================================================================
--- branches/photoviewer/ui/ui.photoviewer.js (original)
+++ branches/photoviewer/ui/ui.photoviewer.js Thu May 14 01:43:00 2009
@@ -133,8 +133,18 @@
}).each(self.options.showOverlay);
$(this).each(self.options.show);
}
+ self._preloadNeighbours();
})
+ },
+
+ _preloadNeighbours: function() {
+ var anchors = this._anchors(),
+ index = anchors.index(this.currentAnchor),
+ previous = anchors.filter(":eq(" + (index == 0 ? anchors.length - 1 :
index - 1) + ")"),
+ next = anchors.filter(":eq(" + (index == anchors.length - 1 ? 0 :
index + 1) + ")");
+ new Image().src = previous.attr("href");
+ new Image().src = next.attr("href");
},
_position: function(img) {