zurb-foundation-5 5.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +7 -0
  2. data/.bowerrc +3 -0
  3. data/.editorconfig +9 -0
  4. data/.gitignore +46 -0
  5. data/.travis.yml +34 -0
  6. data/CONTRIBUTING.md +55 -0
  7. data/Gemfile +3 -0
  8. data/Gemfile.lock +16 -0
  9. data/Gruntfile.js +222 -0
  10. data/LICENSE +22 -0
  11. data/README.md +44 -0
  12. data/bower.json +20 -0
  13. data/composer.json +9 -0
  14. data/foundation.gemspec +21 -0
  15. data/humans.txt +8 -0
  16. data/js/foundation/foundation.abide.js +299 -0
  17. data/js/foundation/foundation.accordion.js +54 -0
  18. data/js/foundation/foundation.alert.js +43 -0
  19. data/js/foundation/foundation.clearing.js +531 -0
  20. data/js/foundation/foundation.dropdown.js +306 -0
  21. data/js/foundation/foundation.equalizer.js +68 -0
  22. data/js/foundation/foundation.interchange.js +331 -0
  23. data/js/foundation/foundation.joyride.js +849 -0
  24. data/js/foundation/foundation.js +609 -0
  25. data/js/foundation/foundation.magellan.js +173 -0
  26. data/js/foundation/foundation.offcanvas.js +50 -0
  27. data/js/foundation/foundation.orbit.js +606 -0
  28. data/js/foundation/foundation.reveal.js +427 -0
  29. data/js/foundation/foundation.slider.js +200 -0
  30. data/js/foundation/foundation.tab.js +168 -0
  31. data/js/foundation/foundation.tooltip.js +272 -0
  32. data/js/foundation/foundation.topbar.js +422 -0
  33. data/karma.conf.js +114 -0
  34. data/lib/foundation/engine.rb +20 -0
  35. data/lib/foundation/generators/USAGE +15 -0
  36. data/lib/foundation/generators/install_generator.rb +54 -0
  37. data/lib/foundation/generators/templates/application.html.erb +47 -0
  38. data/lib/foundation/generators/templates/application.html.haml +31 -0
  39. data/lib/foundation/generators/templates/application.html.slim +35 -0
  40. data/lib/foundation/sprockets.rb +4 -0
  41. data/lib/foundation/version.rb +3 -0
  42. data/lib/scss.js +114 -0
  43. data/lib/zurb-foundation.rb +33 -0
  44. data/package.json +48 -0
  45. data/robots.txt +4 -0
  46. data/run-tests.sh +83 -0
  47. data/sache.json +5 -0
  48. data/scss/foundation.scss +45 -0
  49. data/scss/foundation/_functions.scss +101 -0
  50. data/scss/foundation/_settings.scss +1279 -0
  51. data/scss/foundation/components/_accordion.scss +52 -0
  52. data/scss/foundation/components/_alert-boxes.scss +126 -0
  53. data/scss/foundation/components/_block-grid.scss +132 -0
  54. data/scss/foundation/components/_breadcrumbs.scss +127 -0
  55. data/scss/foundation/components/_button-groups.scss +108 -0
  56. data/scss/foundation/components/_buttons.scss +222 -0
  57. data/scss/foundation/components/_clearing.scss +247 -0
  58. data/scss/foundation/components/_dropdown-buttons.scss +129 -0
  59. data/scss/foundation/components/_dropdown.scss +248 -0
  60. data/scss/foundation/components/_flex-video.scss +51 -0
  61. data/scss/foundation/components/_forms.scss +496 -0
  62. data/scss/foundation/components/_global.scss +365 -0
  63. data/scss/foundation/components/_grid.scss +261 -0
  64. data/scss/foundation/components/_inline-lists.scss +56 -0
  65. data/scss/foundation/components/_joyride.scss +220 -0
  66. data/scss/foundation/components/_keystrokes.scss +61 -0
  67. data/scss/foundation/components/_labels.scss +104 -0
  68. data/scss/foundation/components/_magellan.scss +34 -0
  69. data/scss/foundation/components/_offcanvas.scss +381 -0
  70. data/scss/foundation/components/_orbit.scss +415 -0
  71. data/scss/foundation/components/_pagination.scss +150 -0
  72. data/scss/foundation/components/_panels.scss +91 -0
  73. data/scss/foundation/components/_pricing-tables.scss +150 -0
  74. data/scss/foundation/components/_progress-bars.scss +79 -0
  75. data/scss/foundation/components/_range-slider.scss +148 -0
  76. data/scss/foundation/components/_reveal-new.scss +0 -0
  77. data/scss/foundation/components/_reveal.scss +216 -0
  78. data/scss/foundation/components/_side-nav.scss +93 -0
  79. data/scss/foundation/components/_split-buttons.scss +191 -0
  80. data/scss/foundation/components/_sub-nav.scss +125 -0
  81. data/scss/foundation/components/_switch.scss +294 -0
  82. data/scss/foundation/components/_tables.scss +97 -0
  83. data/scss/foundation/components/_tabs.scss +105 -0
  84. data/scss/foundation/components/_thumbs.scss +68 -0
  85. data/scss/foundation/components/_tooltips.scss +140 -0
  86. data/scss/foundation/components/_top-bar.scss +640 -0
  87. data/scss/foundation/components/_type.scss +493 -0
  88. data/scss/foundation/components/_visibility.scss +345 -0
  89. data/scss/foundation/test.html +0 -0
  90. data/scss/normalize.scss +423 -0
  91. data/spec/abide/abide.js +173 -0
  92. data/spec/abide/advanced.html +22 -0
  93. data/spec/abide/basic.html +13 -0
  94. data/spec/accordion/accordion.js +94 -0
  95. data/spec/accordion/basic.html +39 -0
  96. data/spec/accordion/grid.html +44 -0
  97. data/spec/accordion/multiexpand.html +20 -0
  98. data/spec/alert/alert.js +35 -0
  99. data/spec/alert/basic.html +4 -0
  100. data/spec/clearing/222.gif +0 -0
  101. data/spec/clearing/777.gif +0 -0
  102. data/spec/clearing/basic.html +5 -0
  103. data/spec/clearing/ccc.gif +0 -0
  104. data/spec/clearing/clearing.js +55 -0
  105. data/spec/dropdown/basic.html +10 -0
  106. data/spec/dropdown/dropdown.js +65 -0
  107. data/spec/equalizer/basic.html +24 -0
  108. data/spec/equalizer/equalizer.js +30 -0
  109. data/spec/framework/framework.js +14 -0
  110. data/spec/helpers.js +37 -0
  111. data/spec/interchange/basic.html +3 -0
  112. data/spec/interchange/interchange.js +60 -0
  113. data/spec/joyride/joyride.js +14 -0
  114. data/spec/magellan/magellan.js +14 -0
  115. data/spec/offcanvas/offcanvas.js +14 -0
  116. data/spec/orbit/orbit.js +14 -0
  117. data/spec/reveal/reveal.js +14 -0
  118. data/spec/tab/tab.js +14 -0
  119. data/spec/tooltip/tooltip.js +14 -0
  120. data/spec/topbar/multidropdown.html +60 -0
  121. data/spec/topbar/sticky.html +31 -0
  122. data/spec/topbar/topbar.js +96 -0
  123. metadata +238 -0
@@ -0,0 +1,173 @@
1
+ ;(function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ Foundation.libs['magellan-expedition'] = {
5
+ name : 'magellan-expedition',
6
+
7
+ version : '5.2.2',
8
+
9
+ settings : {
10
+ active_class: 'active',
11
+ threshold: 0, // pixels from the top of the expedition for it to become fixes
12
+ destination_threshold: 20, // pixels from the top of destination for it to be considered active
13
+ throttle_delay: 30 // calculation throttling to increase framerate
14
+ },
15
+
16
+ init : function (scope, method, options) {
17
+ Foundation.inherit(this, 'throttle');
18
+ this.bindings(method, options);
19
+ },
20
+
21
+ events : function () {
22
+ var self = this,
23
+ S = self.S,
24
+ settings = self.settings;
25
+
26
+ // initialize expedition offset
27
+ self.set_expedition_position();
28
+
29
+ S(self.scope)
30
+ .off('.magellan')
31
+ .on('click.fndtn.magellan', '[' + self.add_namespace('data-magellan-arrival') + '] a[href^="#"]', function (e) {
32
+ e.preventDefault();
33
+ var expedition = $(this).closest('[' + self.attr_name() + ']'),
34
+ settings = expedition.data('magellan-expedition-init');
35
+
36
+ var hash = this.hash.split('#').join(''),
37
+ target = $("a[name='"+hash+"']");
38
+ if (target.length === 0) target = $('#'+hash);
39
+
40
+ // Account for expedition height if fixed position
41
+ var scroll_top = target.offset().top;
42
+ scroll_top = scroll_top - expedition.outerHeight();
43
+
44
+ $('html, body').stop().animate({
45
+ 'scrollTop': scroll_top
46
+ }, 700, 'swing', function () {
47
+ if(history.pushState) {
48
+ history.pushState(null, null, '#'+hash);
49
+ }
50
+ else {
51
+ location.hash = '#'+hash;
52
+ }
53
+ });
54
+ })
55
+ .on('scroll.fndtn.magellan', self.throttle(this.check_for_arrivals.bind(this), settings.throttle_delay))
56
+ $(window).on('resize.fndtn.magellan', self.throttle(this.set_expedition_position.bind(this), settings.throttle_delay));
57
+ },
58
+
59
+ check_for_arrivals : function() {
60
+ var self = this;
61
+ self.update_arrivals();
62
+ self.update_expedition_positions();
63
+ },
64
+
65
+ set_expedition_position : function() {
66
+ var self = this;
67
+ $('[' + this.attr_name() + '=fixed]', self.scope).each(function(idx, el) {
68
+ var expedition = $(this),
69
+ styles = expedition.attr('styles'), // save styles
70
+ top_offset;
71
+
72
+ expedition.attr('style', '');
73
+ top_offset = expedition.offset().top;
74
+
75
+ expedition.data(self.data_attr('magellan-top-offset'), top_offset);
76
+ expedition.attr('style', styles);
77
+ });
78
+ },
79
+
80
+ update_expedition_positions : function() {
81
+ var self = this,
82
+ window_top_offset = $(window).scrollTop();
83
+
84
+ $('[' + this.attr_name() + '=fixed]', self.scope).each(function() {
85
+ var expedition = $(this),
86
+ top_offset = expedition.data('magellan-top-offset');
87
+
88
+ if (window_top_offset >= top_offset) {
89
+ // Placeholder allows height calculations to be consistent even when
90
+ // appearing to switch between fixed/non-fixed placement
91
+ var placeholder = expedition.prev('[' + self.add_namespace('data-magellan-expedition-clone') + ']');
92
+ if (placeholder.length === 0) {
93
+ placeholder = expedition.clone();
94
+ placeholder.removeAttr(self.attr_name());
95
+ placeholder.attr(self.add_namespace('data-magellan-expedition-clone'),'');
96
+ expedition.before(placeholder);
97
+ }
98
+ expedition.css({position:'fixed', top: 0});
99
+ } else {
100
+ expedition.prev('[' + self.add_namespace('data-magellan-expedition-clone') + ']').remove();
101
+ expedition.attr('style','');
102
+ }
103
+ });
104
+ },
105
+
106
+ update_arrivals : function() {
107
+ var self = this,
108
+ window_top_offset = $(window).scrollTop();
109
+
110
+ $('[' + this.attr_name() + ']', self.scope).each(function() {
111
+ var expedition = $(this),
112
+ settings = settings = expedition.data(self.attr_name(true) + '-init'),
113
+ offsets = self.offsets(expedition, window_top_offset),
114
+ arrivals = expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']'),
115
+ active_item = false;
116
+ offsets.each(function(idx, item) {
117
+ if (item.viewport_offset >= item.top_offset) {
118
+ var arrivals = expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']');
119
+ arrivals.not(item.arrival).removeClass(settings.active_class);
120
+ item.arrival.addClass(settings.active_class);
121
+ active_item = true;
122
+ return true;
123
+ }
124
+ });
125
+
126
+ if (!active_item) arrivals.removeClass(settings.active_class);
127
+ });
128
+ },
129
+
130
+ offsets : function(expedition, window_offset) {
131
+ var self = this,
132
+ settings = expedition.data(self.attr_name(true) + '-init'),
133
+ viewport_offset = window_offset;
134
+
135
+ return expedition.find('[' + self.add_namespace('data-magellan-arrival') + ']').map(function(idx, el) {
136
+ var name = $(this).data(self.data_attr('magellan-arrival')),
137
+ dest = $('[' + self.add_namespace('data-magellan-destination') + '=' + name + ']');
138
+ if (dest.length > 0) {
139
+ var top_offset = dest.offset().top - settings.destination_threshold - expedition.outerHeight();
140
+ return {
141
+ destination : dest,
142
+ arrival : $(this),
143
+ top_offset : top_offset,
144
+ viewport_offset : viewport_offset
145
+ }
146
+ }
147
+ }).sort(function(a, b) {
148
+ if (a.top_offset < b.top_offset) return -1;
149
+ if (a.top_offset > b.top_offset) return 1;
150
+ return 0;
151
+ });
152
+ },
153
+
154
+ data_attr: function (str) {
155
+ if (this.namespace.length > 0) {
156
+ return this.namespace + '-' + str;
157
+ }
158
+
159
+ return str;
160
+ },
161
+
162
+ off : function () {
163
+ this.S(this.scope).off('.magellan');
164
+ this.S(window).off('.magellan');
165
+ },
166
+
167
+ reflow : function () {
168
+ var self = this;
169
+ // remove placeholder expeditions used for height calculation purposes
170
+ $('[' + self.add_namespace('data-magellan-expedition-clone') + ']', self.scope).remove();
171
+ }
172
+ };
173
+ }(jQuery, this, this.document));
@@ -0,0 +1,50 @@
1
+ ;(function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ Foundation.libs.offcanvas = {
5
+ name : 'offcanvas',
6
+
7
+ version : '5.2.2',
8
+
9
+ settings : {},
10
+
11
+ init : function (scope, method, options) {
12
+ this.events();
13
+ },
14
+
15
+ events : function () {
16
+ var self = this,
17
+ S = self.S;
18
+
19
+ S(this.scope).off('.offcanvas')
20
+ .on('click.fndtn.offcanvas', '.left-off-canvas-toggle', function (e) {
21
+ self.click_toggle_class(e, 'move-right');
22
+ })
23
+ .on('click.fndtn.offcanvas', '.left-off-canvas-menu a', function (e) {
24
+ S(".off-canvas-wrap").removeClass("move-right");
25
+ })
26
+ .on('click.fndtn.offcanvas', '.right-off-canvas-toggle', function (e) {
27
+ self.click_toggle_class(e, 'move-left');
28
+ })
29
+ .on('click.fndtn.offcanvas', '.right-off-canvas-menu a', function (e) {
30
+ S(".off-canvas-wrap").removeClass("move-left");
31
+ })
32
+ .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) {
33
+ self.click_remove_class(e, 'move-left');
34
+ self.click_remove_class(e, 'move-right');
35
+ })
36
+ },
37
+
38
+ click_toggle_class: function(e, class_name) {
39
+ e.preventDefault();
40
+ this.S(e.target).closest('.off-canvas-wrap').toggleClass(class_name);
41
+ },
42
+
43
+ click_remove_class: function(e, class_name) {
44
+ e.preventDefault();
45
+ this.S('.off-canvas-wrap').removeClass(class_name);
46
+ },
47
+
48
+ reflow : function () {}
49
+ };
50
+ }(jQuery, this, this.document));
@@ -0,0 +1,606 @@
1
+ ;(function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ var noop = function() {};
5
+
6
+ var Orbit = function(el, settings) {
7
+ // Don't reinitialize plugin
8
+ if (el.hasClass(settings.slides_container_class)) {
9
+ return this;
10
+ }
11
+
12
+ var self = this,
13
+ container,
14
+ slides_container = el,
15
+ number_container,
16
+ bullets_container,
17
+ timer_container,
18
+ idx = 0,
19
+ animate,
20
+ adjust_height_after = false,
21
+ has_init_active = slides_container.find("." + settings.active_slide_class).length > 0;
22
+
23
+ self.cache = {};
24
+
25
+ self.slides = function() {
26
+ return slides_container.children(settings.slide_selector);
27
+ };
28
+
29
+ if (!has_init_active) {self.slides().first().addClass(settings.active_slide_class)};
30
+
31
+ self.update_slide_number = function(index) {
32
+ if (settings.slide_number) {
33
+ number_container.find('span:first').text(parseInt(index)+1);
34
+ number_container.find('span:last').text(self.slides().length);
35
+ }
36
+ if (settings.bullets) {
37
+ bullets_container.children().removeClass(settings.bullets_active_class);
38
+ $(bullets_container.children().get(index)).addClass(settings.bullets_active_class);
39
+ }
40
+ };
41
+
42
+ self.update_active_link = function(index) {
43
+ var link = $('[data-orbit-link="'+self.slides().eq(index).attr('data-orbit-slide')+'"]');
44
+ link.siblings().removeClass(settings.bullets_active_class);
45
+ link.addClass(settings.bullets_active_class);
46
+ };
47
+
48
+ self.build_markup = function() {
49
+ slides_container.wrap('<div class="'+settings.container_class+'"></div>');
50
+ container = slides_container.parent();
51
+ slides_container.addClass(settings.slides_container_class);
52
+ slides_container.addClass(settings.animation);
53
+
54
+ if (settings.stack_on_small) {
55
+ container.addClass(settings.stack_on_small_class);
56
+ }
57
+
58
+ if (settings.navigation_arrows) {
59
+ container.append($('<a href="#"><span></span></a>').addClass(settings.prev_class));
60
+ container.append($('<a href="#"><span></span></a>').addClass(settings.next_class));
61
+ }
62
+
63
+ if (settings.timer) {
64
+ timer_container = $('<div>').addClass(settings.timer_container_class);
65
+ timer_container.append('<span>');
66
+ if (settings.timer_show_progress_bar) {
67
+ timer_container.append($('<div>').addClass(settings.timer_progress_class));
68
+ }
69
+ timer_container.addClass(settings.timer_paused_class);
70
+ container.append(timer_container);
71
+ }
72
+
73
+ if (settings.slide_number) {
74
+ number_container = $('<div>').addClass(settings.slide_number_class);
75
+ number_container.append('<span></span> ' + settings.slide_number_text + ' <span></span>');
76
+ container.append(number_container);
77
+ }
78
+
79
+ if (settings.bullets) {
80
+ bullets_container = $('<ol>').addClass(settings.bullets_container_class);
81
+ container.append(bullets_container);
82
+ bullets_container.wrap('<div class="orbit-bullets-container"></div>');
83
+ self.slides().each(function(idx, el) {
84
+ var bullet = $('<li>').attr('data-orbit-slide', idx);
85
+ bullets_container.append(bullet);
86
+ });
87
+ }
88
+
89
+ };
90
+
91
+ self._prepare_direction = function(next_idx, current_direction) {
92
+ var dir = 'next';
93
+ if (next_idx <= idx) { dir = 'prev'; }
94
+
95
+ if (settings.animation === 'slide') {
96
+ setTimeout(function(){
97
+ slides_container.removeClass("swipe-prev swipe-next");
98
+ if (dir === 'next') {slides_container.addClass("swipe-next");}
99
+ else if (dir === 'prev') {slides_container.addClass("swipe-prev");}
100
+ },0);
101
+ }
102
+
103
+ var slides = self.slides();
104
+ if (next_idx >= slides.length) {
105
+ if (!settings.circular) return false;
106
+ next_idx = 0;
107
+ } else if (next_idx < 0) {
108
+ if (!settings.circular) return false;
109
+ next_idx = slides.length - 1;
110
+ }
111
+ var current = $(slides.get(idx))
112
+ , next = $(slides.get(next_idx));
113
+
114
+ return [dir, current, next, next_idx];
115
+ };
116
+
117
+ self._goto = function(next_idx, start_timer) {
118
+ if (next_idx === null) {return false;}
119
+ if (self.cache.animating) {return false;}
120
+ if (next_idx === idx) {return false;}
121
+ if (typeof self.cache.timer === 'object') {self.cache.timer.restart();}
122
+
123
+ var slides = self.slides();
124
+ self.cache.animating = true;
125
+ var res = self._prepare_direction(next_idx)
126
+ , dir = res[0]
127
+ , current = res[1]
128
+ , next = res[2]
129
+ , next_idx = res[3];
130
+
131
+ // This means that circular is disabled and we most likely reached the last slide.
132
+ if (res === false) return false;
133
+
134
+ slides_container.trigger('before-slide-change.fndtn.orbit');
135
+ settings.before_slide_change();
136
+ idx = next_idx;
137
+
138
+ current.css("transitionDuration", settings.animation_speed+"ms");
139
+ next.css("transitionDuration", settings.animation_speed+"ms");
140
+
141
+ var callback = function() {
142
+ var unlock = function() {
143
+ if (start_timer === true) {self.cache.timer.restart();}
144
+ self.update_slide_number(idx);
145
+ next.addClass(settings.active_slide_class);
146
+ self.update_active_link(next_idx);
147
+ slides_container.trigger('after-slide-change.fndtn.orbit',[{slide_number: idx, total_slides: slides.length}]);
148
+ settings.after_slide_change(idx, slides.length);
149
+ setTimeout(function(){
150
+ self.cache.animating = false;
151
+ }, 100);
152
+
153
+ };
154
+ if (slides_container.height() != next.height() && settings.variable_height) {
155
+ slides_container.animate({'height': next.height()}, 250, 'linear', unlock);
156
+ } else {
157
+ unlock();
158
+ }
159
+ };
160
+
161
+ if (slides.length === 1) {callback(); return false;}
162
+
163
+ var start_animation = function() {
164
+ if (dir === 'next') {animate.next(current, next, callback);}
165
+ if (dir === 'prev') {animate.prev(current, next, callback);}
166
+ };
167
+
168
+ if (next.height() > slides_container.height() && settings.variable_height) {
169
+ slides_container.animate({'height': next.height()}, 250, 'linear', start_animation);
170
+ } else {
171
+ start_animation();
172
+ }
173
+ };
174
+
175
+ self.next = function(e) {
176
+ e.stopImmediatePropagation();
177
+ e.preventDefault();
178
+ self._prepare_direction(idx + 1);
179
+ setTimeout(function(){
180
+ self._goto(idx + 1);
181
+ }, 100);
182
+ };
183
+
184
+ self.prev = function(e) {
185
+ e.stopImmediatePropagation();
186
+ e.preventDefault();
187
+ self._prepare_direction(idx - 1);
188
+ setTimeout(function(){
189
+ self._goto(idx - 1)
190
+ }, 100);
191
+ };
192
+
193
+ self.link_custom = function(e) {
194
+ e.preventDefault();
195
+ var link = $(this).attr('data-orbit-link');
196
+ if ((typeof link === 'string') && (link = $.trim(link)) != "") {
197
+ var slide = container.find('[data-orbit-slide='+link+']');
198
+ if (slide.index() != -1) {
199
+ setTimeout(function(){
200
+ self._goto(slide.index());
201
+ },100);
202
+ }
203
+ }
204
+ };
205
+
206
+ self.link_bullet = function(e) {
207
+ var index = $(this).attr('data-orbit-slide');
208
+ if ((typeof index === 'string') && (index = $.trim(index)) != "") {
209
+ if(isNaN(parseInt(index)))
210
+ {
211
+ var slide = container.find('[data-orbit-slide='+index+']');
212
+ if (slide.index() != -1) {
213
+ setTimeout(function(){
214
+ self._goto(slide.index() + 1);
215
+ },100);
216
+ }
217
+ }
218
+ else
219
+ {
220
+ setTimeout(function(){
221
+ self._goto(parseInt(index));
222
+ },100);
223
+ }
224
+ }
225
+
226
+ }
227
+
228
+ self.timer_callback = function() {
229
+ self._goto(idx + 1, true);
230
+ }
231
+
232
+ self.compute_dimensions = function() {
233
+ var current = $(self.slides().get(idx));
234
+ var h = current.height();
235
+ if (!settings.variable_height) {
236
+ self.slides().each(function(){
237
+ if ($(this).height() > h) { h = $(this).height(); }
238
+ });
239
+ }
240
+ slides_container.height(h);
241
+ };
242
+
243
+ self.create_timer = function() {
244
+ var t = new Timer(
245
+ container.find('.'+settings.timer_container_class),
246
+ settings,
247
+ self.timer_callback
248
+ );
249
+ return t;
250
+ };
251
+
252
+ self.stop_timer = function() {
253
+ if (typeof self.cache.timer === 'object') self.cache.timer.stop();
254
+ };
255
+
256
+ self.toggle_timer = function() {
257
+ var t = container.find('.'+settings.timer_container_class);
258
+ if (t.hasClass(settings.timer_paused_class)) {
259
+ if (typeof self.cache.timer === 'undefined') {self.cache.timer = self.create_timer();}
260
+ self.cache.timer.start();
261
+ }
262
+ else {
263
+ if (typeof self.cache.timer === 'object') {self.cache.timer.stop();}
264
+ }
265
+ };
266
+
267
+ self.init = function() {
268
+ self.build_markup();
269
+ if (settings.timer) {
270
+ self.cache.timer = self.create_timer();
271
+ Foundation.utils.image_loaded(this.slides().children('img'), self.cache.timer.start);
272
+ }
273
+
274
+ animate = new CSSAnimation(settings, slides_container);
275
+
276
+ if (has_init_active) {
277
+ var $init_target = slides_container.find("." + settings.active_slide_class),
278
+ animation_speed = settings.animation_speed;
279
+ settings.animation_speed = 1;
280
+ $init_target.removeClass('active');
281
+ self._goto($init_target.index());
282
+ settings.animation_speed = animation_speed;
283
+ }
284
+
285
+ container.on('click', '.'+settings.next_class, self.next);
286
+ container.on('click', '.'+settings.prev_class, self.prev);
287
+
288
+ if (settings.next_on_click) {
289
+ container.on('click', '[data-orbit-slide]', self.link_bullet);
290
+ }
291
+
292
+ container.on('click', self.toggle_timer);
293
+ if (settings.swipe) {
294
+ slides_container.on('touchstart.fndtn.orbit',function(e) {
295
+ if (self.cache.animating) {return;}
296
+ if (!e.touches) {e = e.originalEvent;}
297
+ e.preventDefault();
298
+ e.stopPropagation();
299
+
300
+ self.cache.start_page_x = e.touches[0].pageX;
301
+ self.cache.start_page_y = e.touches[0].pageY;
302
+ self.cache.start_time = (new Date()).getTime();
303
+ self.cache.delta_x = 0;
304
+ self.cache.is_scrolling = null;
305
+ self.cache.direction = null;
306
+
307
+ self.stop_timer(); // does not appear to prevent callback from occurring
308
+ })
309
+ .on('touchmove.fndtn.orbit',function(e) {
310
+ if (Math.abs(self.cache.delta_x) > 5) {
311
+ e.preventDefault();
312
+ e.stopPropagation();
313
+ }
314
+
315
+ if (self.cache.animating) {return;}
316
+ requestAnimationFrame(function(){
317
+ if (!e.touches) { e = e.originalEvent; }
318
+
319
+ // Ignore pinch/zoom events
320
+ if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
321
+
322
+ self.cache.delta_x = e.touches[0].pageX - self.cache.start_page_x;
323
+
324
+ if (self.cache.is_scrolling === null) {
325
+ self.cache.is_scrolling = !!( self.cache.is_scrolling || Math.abs(self.cache.delta_x) < Math.abs(e.touches[0].pageY - self.cache.start_page_y) );
326
+ }
327
+
328
+ if (self.cache.is_scrolling) {
329
+ return;
330
+ }
331
+
332
+ var direction = (self.cache.delta_x < 0) ? (idx+1) : (idx-1);
333
+ if (self.cache.direction !== direction) {
334
+ var res = self._prepare_direction(direction);
335
+ self.cache.direction = direction;
336
+ self.cache.dir = res[0];
337
+ self.cache.current = res[1];
338
+ self.cache.next = res[2];
339
+ }
340
+
341
+ if (settings.animation === 'slide') {
342
+ var offset, next_offset;
343
+
344
+ offset = (self.cache.delta_x / container.width()) * 100;
345
+ if (offset >= 0) {next_offset = -(100 - offset);}
346
+ else {next_offset = 100 + offset;}
347
+
348
+ self.cache.current.css("transform","translate3d("+offset+"%,0,0)");
349
+ self.cache.next.css("transform","translate3d("+next_offset+"%,0,0)");
350
+ }
351
+ });
352
+ })
353
+ .on('touchend.fndtn.orbit', function(e) {
354
+ if (self.cache.animating) {return;}
355
+ e.preventDefault();
356
+ e.stopPropagation();
357
+ setTimeout(function(){
358
+ self._goto(self.cache.direction);
359
+ }, 50);
360
+ });
361
+ }
362
+ container.on('mouseenter.fndtn.orbit', function(e) {
363
+ if (settings.timer && settings.pause_on_hover) {
364
+ self.stop_timer();
365
+ }
366
+ })
367
+ .on('mouseleave.fndtn.orbit', function(e) {
368
+ if (settings.timer && settings.resume_on_mouseout) {
369
+ self.cache.timer.start();
370
+ }
371
+ });
372
+
373
+ $(document).on('click', '[data-orbit-link]', self.link_custom);
374
+ $(window).on('load resize', self.compute_dimensions);
375
+ var children = this.slides().find('img');
376
+ Foundation.utils.image_loaded(children, self.compute_dimensions);
377
+ Foundation.utils.image_loaded(children, function() {
378
+ container.prev('.'+settings.preloader_class).css('display', 'none');
379
+ self.update_slide_number(idx);
380
+ self.update_active_link(idx);
381
+ slides_container.trigger('ready.fndtn.orbit');
382
+ });
383
+ };
384
+
385
+ self.init();
386
+ };
387
+
388
+ var Timer = function(el, settings, callback) {
389
+ var self = this,
390
+ duration = settings.timer_speed,
391
+ progress = el.find('.'+settings.timer_progress_class),
392
+ do_progress = progress && progress.css('display') != 'none',
393
+ start,
394
+ timeout,
395
+ left = -1;
396
+
397
+ this.update_progress = function(w) {
398
+ var new_progress = progress.clone();
399
+ new_progress.attr('style', '');
400
+ new_progress.css('width', w+'%');
401
+ progress.replaceWith(new_progress);
402
+ progress = new_progress;
403
+ };
404
+
405
+ this.restart = function() {
406
+ clearTimeout(timeout);
407
+ el.addClass(settings.timer_paused_class);
408
+ left = -1;
409
+ if (do_progress) {self.update_progress(0);}
410
+ self.start();
411
+ };
412
+
413
+ this.start = function() {
414
+ if (!el.hasClass(settings.timer_paused_class)) {return true;}
415
+ left = (left === -1) ? duration : left;
416
+ el.removeClass(settings.timer_paused_class);
417
+ if (do_progress) {
418
+ start = new Date().getTime();
419
+ progress.animate({'width': '100%'}, left, 'linear');
420
+ }
421
+ timeout = setTimeout(function() {
422
+ self.restart();
423
+ callback();
424
+ }, left);
425
+ el.trigger('timer-started.fndtn.orbit')
426
+ };
427
+
428
+ this.stop = function() {
429
+ if (el.hasClass(settings.timer_paused_class)) {return true;}
430
+ clearTimeout(timeout);
431
+ el.addClass(settings.timer_paused_class);
432
+ if (do_progress) {
433
+ var end = new Date().getTime();
434
+ left = left - (end - start);
435
+ var w = 100 - ((left / duration) * 100);
436
+ self.update_progress(w);
437
+ }
438
+ el.trigger('timer-stopped.fndtn.orbit');
439
+ };
440
+ };
441
+
442
+ var CSSAnimation = function(settings, container) {
443
+ var animation_end = "webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend";
444
+
445
+ this.next = function(current, next, callback) {
446
+ if (Modernizr.csstransitions) {
447
+ next.on(animation_end, function(e){
448
+ next.unbind(animation_end);
449
+ current.removeClass("active animate-out");
450
+ next.removeClass("animate-in");
451
+ container.children().css({
452
+ "transform":"",
453
+ "-ms-transform":"",
454
+ "-webkit-transition-duration":"",
455
+ "-moz-transition-duration": "",
456
+ "-o-transition-duration": "",
457
+ "transition-duration":""
458
+ });
459
+ callback();
460
+ });
461
+ } else {
462
+ setTimeout(function(){
463
+ current.removeClass("active animate-out");
464
+ next.removeClass("animate-in");
465
+ container.children().css({
466
+ "transform":"",
467
+ "-ms-transform":"",
468
+ "-webkit-transition-duration":"",
469
+ "-moz-transition-duration": "",
470
+ "-o-transition-duration": "",
471
+ "transition-duration":""
472
+ });
473
+ callback();
474
+ }, settings.animation_speed);
475
+ }
476
+ container.children().css({
477
+ "transform":"",
478
+ "-ms-transform":"",
479
+ "-webkit-transition-duration":"",
480
+ "-moz-transition-duration": "",
481
+ "-o-transition-duration": "",
482
+ "transition-duration":""
483
+ });
484
+ current.addClass("animate-out");
485
+ next.addClass("animate-in");
486
+ };
487
+
488
+ this.prev = function(current, prev, callback) {
489
+ if (Modernizr.csstransitions) {
490
+ prev.on(animation_end, function(e){
491
+ prev.unbind(animation_end);
492
+ current.removeClass("active animate-out");
493
+ prev.removeClass("animate-in");
494
+ container.children().css({
495
+ "transform":"",
496
+ "-ms-transform":"",
497
+ "-webkit-transition-duration":"",
498
+ "-moz-transition-duration": "",
499
+ "-o-transition-duration": "",
500
+ "transition-duration":""
501
+ });
502
+ callback();
503
+ });
504
+ } else {
505
+ setTimeout(function(){
506
+ current.removeClass("active animate-out");
507
+ prev.removeClass("animate-in");
508
+ container.children().css({
509
+ "transform":"",
510
+ "-ms-transform":"",
511
+ "-webkit-transition-duration":"",
512
+ "-moz-transition-duration": "",
513
+ "-o-transition-duration": "",
514
+ "transition-duration":""
515
+ });
516
+ callback();
517
+ }, settings.animation_speed);
518
+ }
519
+ container.children().css({
520
+ "transform":"",
521
+ "-ms-transform":"",
522
+ "-webkit-transition-duration":"",
523
+ "-moz-transition-duration": "",
524
+ "-o-transition-duration": "",
525
+ "transition-duration":""
526
+ });
527
+ current.addClass("animate-out");
528
+ prev.addClass("animate-in");
529
+ };
530
+ };
531
+
532
+
533
+ Foundation.libs = Foundation.libs || {};
534
+
535
+ Foundation.libs.orbit = {
536
+ name: 'orbit',
537
+
538
+ version: '5.2.2',
539
+
540
+ settings: {
541
+ animation: 'slide',
542
+ timer_speed: 10000,
543
+ pause_on_hover: true,
544
+ resume_on_mouseout: false,
545
+ next_on_click: true,
546
+ animation_speed: 500,
547
+ stack_on_small: false,
548
+ navigation_arrows: true,
549
+ slide_number: true,
550
+ slide_number_text: 'of',
551
+ container_class: 'orbit-container',
552
+ stack_on_small_class: 'orbit-stack-on-small',
553
+ next_class: 'orbit-next',
554
+ prev_class: 'orbit-prev',
555
+ timer_container_class: 'orbit-timer',
556
+ timer_paused_class: 'paused',
557
+ timer_progress_class: 'orbit-progress',
558
+ timer_show_progress_bar: true,
559
+ slides_container_class: 'orbit-slides-container',
560
+ preloader_class: 'preloader',
561
+ slide_selector: '*',
562
+ bullets_container_class: 'orbit-bullets',
563
+ bullets_active_class: 'active',
564
+ slide_number_class: 'orbit-slide-number',
565
+ caption_class: 'orbit-caption',
566
+ active_slide_class: 'active',
567
+ orbit_transition_class: 'orbit-transitioning',
568
+ bullets: true,
569
+ circular: true,
570
+ timer: true,
571
+ variable_height: false,
572
+ swipe: true,
573
+ before_slide_change: noop,
574
+ after_slide_change: noop
575
+ },
576
+
577
+ init : function (scope, method, options) {
578
+ var self = this;
579
+ this.bindings(method, options);
580
+ },
581
+
582
+ events : function (instance) {
583
+ var orbit_instance = new Orbit(this.S(instance), this.S(instance).data('orbit-init'));
584
+ this.S(instance).data(self.name + '-instance', orbit_instance);
585
+ },
586
+
587
+ reflow : function () {
588
+ var self = this;
589
+
590
+ if (self.S(self.scope).is('[data-orbit]')) {
591
+ var $el = self.S(self.scope);
592
+ var instance = $el.data(self.name + '-instance');
593
+ instance.compute_dimensions();
594
+ } else {
595
+ self.S('[data-orbit]', self.scope).each(function(idx, el) {
596
+ var $el = self.S(el);
597
+ var opts = self.data_options($el);
598
+ var instance = $el.data(self.name + '-instance');
599
+ instance.compute_dimensions();
600
+ });
601
+ }
602
+ }
603
+ };
604
+
605
+
606
+ }(jQuery, this, this.document));