From ef6af2751ebc10a32c375f1135fd5063449d65ca Mon Sep 17 00:00:00 2001 From: Duncank Date: Wed, 20 Feb 2013 15:14:11 +0100 Subject: [PATCH 1/2] Added option to disable continuous-sliding Now it is possible to set continuous to false to make sure the slider stops at the last slide, instead of loading the first slide again. --- jquery.touchslider.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/jquery.touchslider.js b/jquery.touchslider.js index 1333e42..7c08f8f 100644 --- a/jquery.touchslider.js +++ b/jquery.touchslider.js @@ -29,7 +29,8 @@ http://touchslider.com pagination: "." + namespace + "-nav-item", currentClass: namespace + "-nav-item-current", duration: 350, - mouseTouch: true + mouseTouch: true, + continuous: true // [container, scroller] }, options); @@ -119,9 +120,11 @@ http://touchslider.com to: function(toIndex, opt) { opt = opt || {}; if (toIndex >= slides.length) { - toIndex = 0; + if(options.continuous){ toIndex = 0; } + else { return false; } } else if (toIndex < 0){ - toIndex = slides.length - 1; + if(options.continuous){ toIndex = slides.length - 1; } + else { return false; } } var duration = options.duration, node = slides.eq(toIndex), From 6f25a9e8391b12114f60e8235fe518e624eee6e6 Mon Sep 17 00:00:00 2001 From: Duncank Date: Sat, 23 Feb 2013 12:05:27 +0100 Subject: [PATCH 2/2] indentation update for previous commit updated indentation to match source indentation (hopefully) --- jquery.touchslider.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/jquery.touchslider.js b/jquery.touchslider.js index 7c08f8f..77635c3 100644 --- a/jquery.touchslider.js +++ b/jquery.touchslider.js @@ -120,11 +120,17 @@ http://touchslider.com to: function(toIndex, opt) { opt = opt || {}; if (toIndex >= slides.length) { - if(options.continuous){ toIndex = 0; } - else { return false; } + if(options.continuous){ + toIndex = 0; + } else { + return false; + } } else if (toIndex < 0){ - if(options.continuous){ toIndex = slides.length - 1; } - else { return false; } + if(options.continuous){ + toIndex = slides.length - 1; + } else { + return false; + } } var duration = options.duration, node = slides.eq(toIndex),