]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Add circular option to orbit and resolve issue #3918 4006/head
authorFilipi Zimermann <filipi@nextt.com.br>
Sat, 28 Dec 2013 06:26:50 +0000 (04:26 -0200)
committerFilipi Zimermann <filipi@nextt.com.br>
Sat, 28 Dec 2013 06:26:50 +0000 (04:26 -0200)
doc/pages/components/orbit.html
js/foundation/foundation.orbit.js

index dd2412ca00eed1b89bd64214ff0b229b9acb0bf1..7b0f73d2cae1736e988ffafa899f7d3d4e5c2abd 100644 (file)
@@ -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,
index 515769a3756760399bebe5380b417e803f8d8cb2..2c3ff5fc4850ae326cb34b71c79f2d9090810e1b 100644 (file)
       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));
       active_slide_class: 'active',
       orbit_transition_class: 'orbit-transitioning',
       bullets: true,
+      circular: true,
       timer: true,
       variable_height: false,
       swipe: true,