From: Filipi Zimermann Date: Sat, 28 Dec 2013 06:26:50 +0000 (-0200) Subject: Add circular option to orbit and resolve issue #3918 X-Git-Tag: 5.0.3~26^2 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F4006%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Add circular option to orbit and resolve issue #3918 --- diff --git a/doc/pages/components/orbit.html b/doc/pages/components/orbit.html index dd2412ca0..7b0f73d2c 100644 --- a/doc/pages/components/orbit.html +++ b/doc/pages/components/orbit.html @@ -192,6 +192,7 @@ $(document).foundation({ active_slide_class: 'active', // Class name given to the active slide orbit_transition_class: 'orbit-transitioning', bullets: true, // Does the slider have bullets visible? + circular: true, // Does the slider should go to the first slide after showing the last? timer: true, // Does the slider have a timer visible? variable_height: false, // Does the slider have variable height content? swipe: true, diff --git a/js/foundation/foundation.orbit.js b/js/foundation/foundation.orbit.js index 515769a37..2c3ff5fc4 100644 --- a/js/foundation/foundation.orbit.js +++ b/js/foundation/foundation.orbit.js @@ -91,8 +91,13 @@ var dir = 'next'; locked = true; if (next_idx < idx) {dir = 'prev';} - if (next_idx >= slides.length) {next_idx = 0;} - else if (next_idx < 0) {next_idx = slides.length - 1;} + if (next_idx >= slides.length) { + if (!settings.circular) return false; + next_idx = 0; + } else if (next_idx < 0) { + if (!settings.circular) return false; + next_idx = slides.length - 1; + } var current = $(slides.get(idx)); var next = $(slides.get(next_idx)); @@ -402,6 +407,7 @@ active_slide_class: 'active', orbit_transition_class: 'orbit-transitioning', bullets: true, + circular: true, timer: true, variable_height: false, swipe: true,