From 60466881f5e9a9db1dadff0eb815686b85e4eb61 Mon Sep 17 00:00:00 2001 From: Filipi Zimermann Date: Sat, 28 Dec 2013 04:26:50 -0200 Subject: [PATCH] Add circular option to orbit and resolve issue #3918 --- doc/pages/components/orbit.html | 1 + js/foundation/foundation.orbit.js | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) 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, -- 2.47.2