r2543 - photoviewer: added option to loop gallery
Author: joern.zaefferer
Date: Wed May 13 02:27:01 2009
New Revision: 2543
Modified:
branches/photoviewer/ui/ui.photoviewer.js
Log:
photoviewer: added option to loop gallery
Modified: branches/photoviewer/ui/ui.photoviewer.js
==============================================================================
--- branches/photoviewer/ui/ui.photoviewer.js (original)
+++ branches/photoviewer/ui/ui.photoviewer.js Wed May 13 02:27:01 2009
@@ -103,18 +103,22 @@
},
next: function() {
- this._rotate(":gt(", "):first", "up");
+ this._rotate(":gt(", ":first", "up");
},
prev: function() {
- this._rotate(":lt(", "):last", "down");
+ this._rotate(":lt(", ":last", "down");
},
_rotate: function(selectorA, selectorB, direction) {
if (!this.currentAnchor)
return;
var anchors = this._anchors();
- this._display(anchors.filter(selectorA +
anchors.index(this.currentAnchor) + selectorB)[0], direction);
+ var target = anchors.filter(selectorA +
anchors.index(this.currentAnchor) + ")" + selectorB)[0];
+ if (!target && this.options.loop) {
+ target = anchors.filter(selectorB)[0];
+ }
+ this._display(target, direction);
},
_viewer: function() {
@@ -134,6 +138,7 @@
$.extend($.ui.photoviewer, {
defaults: {
+ loop: true
}
});