diff --git a/demo/index.html b/demo/index.html
index 9d295c3..94a2b48 100644
--- a/demo/index.html
+++ b/demo/index.html
@@ -44,6 +44,7 @@
axis:'xy',// The default is 'y' scroll on both ways
navigation:'#navigation li a',
duration:700,// Length of the animation (if you scroll 2 axes and use queue, then each axis take half this time)
+ wrap:false,
force:true, // Force a scroll to the element specified by 'start' (some browsers don't reset on refreshes)
//queue:false,// We scroll on both axes, scroll both at the same time.
diff --git a/jquery.serialScroll.js b/jquery.serialScroll.js
index 450683d..67bf3b0 100644
--- a/jquery.serialScroll.js
+++ b/jquery.serialScroll.js
@@ -37,7 +37,8 @@
step:1, // how many elements to scroll on each action
lock:true,// ignore events if already animating
cycle:true, // cycle endlessly ( constant velocity )
- constant:true // use contant speed ?
+ constant:true, // use contant speed ?
+ wrap:true // clicking prev on first/last element scrolls to the last/first one
/*
navigation:null,// if specified, it's a selector to a collection of items to navigate the container
target:window, // if specified, it's a selector to the element to be scrolled.
@@ -64,6 +65,8 @@
// ditto
step = settings.step,
// ditto
+ wrap = settings.wrap,
+ // ditto
lazy = settings.lazy,
// if a target is specified, then everything's relative to 'this'.
context = settings.target ? this : document,
@@ -144,6 +147,11 @@
jump( e, this );
});
+ function checkDisableControls( pos, limit ){
+ $(settings.prev).css('visibility', pos <= 0 ? 'hidden' : 'visible');
+ $(settings.next).css('visibility', pos >= limit ? 'hidden' : 'visible');
+ };
+
function move( e ){
e.data += active;
jump( e, this );
@@ -162,6 +170,9 @@
elem = $items[pos],
duration = settings.duration;
+ if( !wrap )
+ checkDisableControls( pos, limit );
+
if( real )
e.preventDefault();
@@ -240,4 +251,4 @@
});
};
-})( jQuery );
\ No newline at end of file
+})( jQuery );