foundation-rails 5.5.3.2 → 6.1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +2 -8
  4. data/Rakefile +23 -0
  5. data/app/views/foundation/rails/styleguide/show.html.erb +2 -5
  6. data/bower.json +2 -2
  7. data/lib/foundation/rails/version.rb +1 -1
  8. data/lib/generators/foundation/install_generator.rb +6 -3
  9. data/lib/generators/foundation/templates/_settings.scss +546 -0
  10. data/lib/generators/foundation/templates/application.html.erb +0 -1
  11. data/lib/generators/foundation/templates/application.html.haml +0 -2
  12. data/lib/generators/foundation/templates/application.html.slim +0 -2
  13. data/lib/generators/foundation/templates/foundation_and_overrides.scss +51 -0
  14. data/vendor/assets/js/foundation.abide.js +418 -0
  15. data/vendor/assets/js/foundation.accordion.js +229 -0
  16. data/vendor/assets/js/foundation.accordionMenu.js +262 -0
  17. data/vendor/assets/js/foundation.core.js +378 -0
  18. data/vendor/assets/js/foundation.drilldown.js +321 -0
  19. data/vendor/assets/js/foundation.dropdown.js +390 -0
  20. data/vendor/assets/js/foundation.dropdownMenu.js +391 -0
  21. data/vendor/assets/js/foundation.equalizer.js +274 -0
  22. data/vendor/assets/js/foundation.interchange.js +184 -0
  23. data/vendor/assets/js/foundation.js +28 -0
  24. data/vendor/assets/js/foundation.magellan.js +212 -0
  25. data/vendor/assets/js/foundation.offcanvas.js +371 -0
  26. data/vendor/assets/js/foundation.orbit.js +419 -0
  27. data/vendor/assets/js/foundation.responsiveMenu.js +145 -0
  28. data/vendor/assets/js/foundation.responsiveToggle.js +106 -0
  29. data/vendor/assets/js/foundation.reveal.js +478 -0
  30. data/vendor/assets/js/foundation.slider.js +484 -0
  31. data/vendor/assets/js/foundation.sticky.js +436 -0
  32. data/vendor/assets/js/foundation.tabs.js +306 -0
  33. data/vendor/assets/js/foundation.toggler.js +147 -0
  34. data/vendor/assets/js/foundation.tooltip.js +429 -0
  35. data/vendor/assets/js/foundation.util.box.js +169 -0
  36. data/vendor/assets/js/foundation.util.keyboard.js +115 -0
  37. data/vendor/assets/js/foundation.util.mediaQuery.js +210 -0
  38. data/vendor/assets/js/foundation.util.motion.js +89 -0
  39. data/vendor/assets/js/foundation.util.nest.js +64 -0
  40. data/vendor/assets/js/foundation.util.timerAndImageLoader.js +78 -0
  41. data/vendor/assets/js/foundation.util.touch.js +339 -0
  42. data/vendor/assets/js/foundation.util.triggers.js +222 -0
  43. data/vendor/assets/scss/_global.scss +626 -0
  44. data/vendor/assets/scss/components/_accordion-menu.scss +32 -0
  45. data/vendor/assets/scss/components/_accordion.scss +113 -0
  46. data/vendor/assets/scss/components/_badge.scss +55 -0
  47. data/vendor/assets/scss/components/_breadcrumbs.scss +94 -0
  48. data/vendor/assets/scss/components/_button-group.scss +130 -0
  49. data/vendor/assets/scss/components/_button.scss +265 -0
  50. data/vendor/assets/scss/components/_callout.scss +105 -0
  51. data/vendor/assets/scss/components/_close-button.scss +61 -0
  52. data/vendor/assets/scss/components/_drilldown.scss +75 -0
  53. data/vendor/assets/scss/components/_dropdown-menu.scss +148 -0
  54. data/vendor/assets/scss/components/_dropdown.scss +64 -0
  55. data/vendor/assets/scss/components/_flex-video.scss +63 -0
  56. data/vendor/assets/scss/components/_float.scss +27 -0
  57. data/vendor/assets/scss/components/_label.scss +56 -0
  58. data/vendor/assets/scss/components/_media-object.scss +74 -0
  59. data/vendor/assets/scss/components/_menu.scss +209 -0
  60. data/vendor/assets/scss/components/_off-canvas.scss +180 -0
  61. data/vendor/assets/scss/components/_orbit.scss +193 -0
  62. data/vendor/assets/scss/components/_pagination.scss +158 -0
  63. data/vendor/assets/scss/components/_progress-bar.scss +83 -0
  64. data/vendor/assets/scss/components/_reveal.scss +156 -0
  65. data/vendor/assets/scss/components/_slider.scss +158 -0
  66. data/vendor/assets/scss/components/_sticky.scss +38 -0
  67. data/vendor/assets/scss/components/_switch.scss +232 -0
  68. data/vendor/assets/scss/components/_table.scss +213 -0
  69. data/vendor/assets/scss/components/_tabs.scss +170 -0
  70. data/vendor/assets/scss/components/_thumbnail.scss +54 -0
  71. data/vendor/assets/scss/components/_title-bar.scss +68 -0
  72. data/vendor/assets/scss/components/_tooltip.scss +100 -0
  73. data/vendor/assets/scss/components/_top-bar.scss +89 -0
  74. data/vendor/assets/scss/components/_visibility.scss +131 -0
  75. data/vendor/assets/scss/forms/_checkbox.scss +36 -0
  76. data/vendor/assets/scss/forms/_error.scss +82 -0
  77. data/vendor/assets/scss/forms/_fieldset.scss +53 -0
  78. data/vendor/assets/scss/forms/_forms.scss +32 -0
  79. data/vendor/assets/scss/forms/_help-text.scss +30 -0
  80. data/vendor/assets/scss/forms/_input-group.scss +91 -0
  81. data/vendor/assets/scss/forms/_label.scss +48 -0
  82. data/vendor/assets/scss/forms/_select.scss +63 -0
  83. data/vendor/assets/scss/forms/_text.scss +154 -0
  84. data/vendor/assets/scss/foundation.scss +91 -0
  85. data/vendor/assets/scss/grid/_classes.scss +153 -0
  86. data/vendor/assets/scss/grid/_column.scss +124 -0
  87. data/vendor/assets/scss/grid/_flex-grid.scss +281 -0
  88. data/vendor/assets/scss/grid/_grid.scss +48 -0
  89. data/vendor/assets/scss/grid/_gutter.scss +34 -0
  90. data/vendor/assets/scss/grid/_layout.scss +33 -0
  91. data/vendor/assets/scss/grid/_position.scss +72 -0
  92. data/vendor/assets/scss/grid/_row.scss +97 -0
  93. data/vendor/assets/scss/grid/_size.scss +24 -0
  94. data/vendor/assets/scss/settings/_settings.scss +547 -0
  95. data/vendor/assets/scss/typography/_alignment.scss +22 -0
  96. data/vendor/assets/scss/typography/_base.scss +439 -0
  97. data/vendor/assets/scss/typography/_helpers.scss +77 -0
  98. data/vendor/assets/scss/typography/_print.scss +73 -0
  99. data/vendor/assets/scss/typography/_typography.scss +28 -0
  100. data/vendor/assets/scss/util/_breakpoint.scss +266 -0
  101. data/vendor/assets/scss/util/_color.scss +41 -0
  102. data/vendor/assets/scss/util/_mixins.scss +223 -0
  103. data/vendor/assets/scss/util/_selector.scss +40 -0
  104. data/vendor/assets/scss/util/_unit.scss +90 -0
  105. data/vendor/assets/scss/util/_util.scss +15 -0
  106. data/vendor/assets/scss/util/_value.scss +126 -0
  107. metadata +97 -64
  108. data/update-gem.sh +0 -20
  109. data/vendor/assets/javascripts/foundation.js +0 -17
  110. data/vendor/assets/javascripts/foundation/foundation.abide.js +0 -426
  111. data/vendor/assets/javascripts/foundation/foundation.accordion.js +0 -125
  112. data/vendor/assets/javascripts/foundation/foundation.alert.js +0 -43
  113. data/vendor/assets/javascripts/foundation/foundation.clearing.js +0 -586
  114. data/vendor/assets/javascripts/foundation/foundation.dropdown.js +0 -468
  115. data/vendor/assets/javascripts/foundation/foundation.equalizer.js +0 -104
  116. data/vendor/assets/javascripts/foundation/foundation.interchange.js +0 -360
  117. data/vendor/assets/javascripts/foundation/foundation.joyride.js +0 -935
  118. data/vendor/assets/javascripts/foundation/foundation.js +0 -732
  119. data/vendor/assets/javascripts/foundation/foundation.magellan.js +0 -214
  120. data/vendor/assets/javascripts/foundation/foundation.offcanvas.js +0 -225
  121. data/vendor/assets/javascripts/foundation/foundation.orbit.js +0 -476
  122. data/vendor/assets/javascripts/foundation/foundation.reveal.js +0 -522
  123. data/vendor/assets/javascripts/foundation/foundation.slider.js +0 -296
  124. data/vendor/assets/javascripts/foundation/foundation.tab.js +0 -247
  125. data/vendor/assets/javascripts/foundation/foundation.tooltip.js +0 -348
  126. data/vendor/assets/javascripts/foundation/foundation.topbar.js +0 -458
  127. data/vendor/assets/javascripts/vendor/modernizr.js +0 -1406
  128. data/vendor/assets/stylesheets/foundation.scss +0 -42
  129. data/vendor/assets/stylesheets/foundation/_functions.scss +0 -156
  130. data/vendor/assets/stylesheets/foundation/_settings.scss +0 -1489
  131. data/vendor/assets/stylesheets/foundation/components/_accordion.scss +0 -161
  132. data/vendor/assets/stylesheets/foundation/components/_alert-boxes.scss +0 -128
  133. data/vendor/assets/stylesheets/foundation/components/_block-grid.scss +0 -133
  134. data/vendor/assets/stylesheets/foundation/components/_breadcrumbs.scss +0 -132
  135. data/vendor/assets/stylesheets/foundation/components/_button-groups.scss +0 -208
  136. data/vendor/assets/stylesheets/foundation/components/_buttons.scss +0 -261
  137. data/vendor/assets/stylesheets/foundation/components/_clearing.scss +0 -260
  138. data/vendor/assets/stylesheets/foundation/components/_dropdown-buttons.scss +0 -130
  139. data/vendor/assets/stylesheets/foundation/components/_dropdown.scss +0 -269
  140. data/vendor/assets/stylesheets/foundation/components/_flex-video.scss +0 -51
  141. data/vendor/assets/stylesheets/foundation/components/_forms.scss +0 -607
  142. data/vendor/assets/stylesheets/foundation/components/_global.scss +0 -566
  143. data/vendor/assets/stylesheets/foundation/components/_grid.scss +0 -292
  144. data/vendor/assets/stylesheets/foundation/components/_icon-bar.scss +0 -460
  145. data/vendor/assets/stylesheets/foundation/components/_inline-lists.scss +0 -58
  146. data/vendor/assets/stylesheets/foundation/components/_joyride.scss +0 -220
  147. data/vendor/assets/stylesheets/foundation/components/_keystrokes.scss +0 -60
  148. data/vendor/assets/stylesheets/foundation/components/_labels.scss +0 -106
  149. data/vendor/assets/stylesheets/foundation/components/_magellan.scss +0 -34
  150. data/vendor/assets/stylesheets/foundation/components/_offcanvas.scss +0 -606
  151. data/vendor/assets/stylesheets/foundation/components/_orbit.scss +0 -388
  152. data/vendor/assets/stylesheets/foundation/components/_pagination.scss +0 -163
  153. data/vendor/assets/stylesheets/foundation/components/_panels.scss +0 -107
  154. data/vendor/assets/stylesheets/foundation/components/_pricing-tables.scss +0 -150
  155. data/vendor/assets/stylesheets/foundation/components/_progress-bars.scss +0 -85
  156. data/vendor/assets/stylesheets/foundation/components/_range-slider.scss +0 -177
  157. data/vendor/assets/stylesheets/foundation/components/_reveal.scss +0 -212
  158. data/vendor/assets/stylesheets/foundation/components/_side-nav.scss +0 -120
  159. data/vendor/assets/stylesheets/foundation/components/_split-buttons.scss +0 -203
  160. data/vendor/assets/stylesheets/foundation/components/_sub-nav.scss +0 -125
  161. data/vendor/assets/stylesheets/foundation/components/_switches.scss +0 -241
  162. data/vendor/assets/stylesheets/foundation/components/_tables.scss +0 -135
  163. data/vendor/assets/stylesheets/foundation/components/_tabs.scss +0 -142
  164. data/vendor/assets/stylesheets/foundation/components/_thumbs.scss +0 -66
  165. data/vendor/assets/stylesheets/foundation/components/_tooltips.scss +0 -142
  166. data/vendor/assets/stylesheets/foundation/components/_top-bar.scss +0 -745
  167. data/vendor/assets/stylesheets/foundation/components/_type.scss +0 -525
  168. data/vendor/assets/stylesheets/foundation/components/_visibility.scss +0 -425
  169. data/vendor/assets/stylesheets/normalize.scss +0 -424
@@ -0,0 +1,419 @@
1
+ /**
2
+ * Orbit module.
3
+ * @module foundation.orbit
4
+ * @requires foundation.util.keyboard
5
+ * @requires foundation.util.motion
6
+ * @requires foundation.util.timerAndImageLoader
7
+ * @requires foundation.util.touch
8
+ */
9
+ !function($, Foundation){
10
+ 'use strict';
11
+ /**
12
+ * Creates a new instance of an orbit carousel.
13
+ * @class
14
+ * @param {jQuery} element - jQuery object to make into an Orbit Carousel.
15
+ * @param {Object} options - Overrides to the default plugin settings.
16
+ */
17
+ function Orbit(element, options){
18
+ this.$element = element;
19
+ this.options = $.extend({}, Orbit.defaults, this.$element.data(), options);
20
+
21
+ this._init();
22
+
23
+ Foundation.registerPlugin(this, 'Orbit');
24
+ Foundation.Keyboard.register('Orbit', {
25
+ 'ltr': {
26
+ 'ARROW_RIGHT': 'next',
27
+ 'ARROW_LEFT': 'previous'
28
+ },
29
+ 'rtl': {
30
+ 'ARROW_LEFT': 'next',
31
+ 'ARROW_RIGHT': 'previous'
32
+ }
33
+ });
34
+ }
35
+ Orbit.defaults = {
36
+ /**
37
+ * Tells the JS to loadBullets.
38
+ * @option
39
+ * @example true
40
+ */
41
+ bullets: true,
42
+ /**
43
+ * Tells the JS to apply event listeners to nav buttons
44
+ * @option
45
+ * @example true
46
+ */
47
+ navButtons: true,
48
+ /**
49
+ * motion-ui animation class to apply
50
+ * @option
51
+ * @example 'slide-in-right'
52
+ */
53
+ animInFromRight: 'slide-in-right',
54
+ /**
55
+ * motion-ui animation class to apply
56
+ * @option
57
+ * @example 'slide-out-right'
58
+ */
59
+ animOutToRight: 'slide-out-right',
60
+ /**
61
+ * motion-ui animation class to apply
62
+ * @option
63
+ * @example 'slide-in-left'
64
+ *
65
+ */
66
+ animInFromLeft: 'slide-in-left',
67
+ /**
68
+ * motion-ui animation class to apply
69
+ * @option
70
+ * @example 'slide-out-left'
71
+ */
72
+ animOutToLeft: 'slide-out-left',
73
+ /**
74
+ * Allows Orbit to automatically animate on page load.
75
+ * @option
76
+ * @example true
77
+ */
78
+ autoPlay: true,
79
+ /**
80
+ * Amount of time, in ms, between slide transitions
81
+ * @option
82
+ * @example 5000
83
+ */
84
+ timerDelay: 5000,
85
+ /**
86
+ * Allows Orbit to infinitely loop through the slides
87
+ * @option
88
+ * @example true
89
+ */
90
+ infiniteWrap: true,
91
+ /**
92
+ * Allows the Orbit slides to bind to swipe events for mobile, requires an additional util library
93
+ * @option
94
+ * @example true
95
+ */
96
+ swipe: true,
97
+ /**
98
+ * Allows the timing function to pause animation on hover.
99
+ * @option
100
+ * @example true
101
+ */
102
+ pauseOnHover: true,
103
+ /**
104
+ * Allows Orbit to bind keyboard events to the slider, to animate frames with arrow keys
105
+ * @option
106
+ * @example true
107
+ */
108
+ accessible: true,
109
+ /**
110
+ * Class applied to the container of Orbit
111
+ * @option
112
+ * @example 'orbit-container'
113
+ */
114
+ containerClass: 'orbit-container',
115
+ /**
116
+ * Class applied to individual slides.
117
+ * @option
118
+ * @example 'orbit-slide'
119
+ */
120
+ slideClass: 'orbit-slide',
121
+ /**
122
+ * Class applied to the bullet container. You're welcome.
123
+ * @option
124
+ * @example 'orbit-bullets'
125
+ */
126
+ boxOfBullets: 'orbit-bullets',
127
+ /**
128
+ * Class applied to the `next` navigation button.
129
+ * @option
130
+ * @example 'orbit-next'
131
+ */
132
+ nextClass: 'orbit-next',
133
+ /**
134
+ * Class applied to the `previous` navigation button.
135
+ * @option
136
+ * @example 'orbit-previous'
137
+ */
138
+ prevClass: 'orbit-previous',
139
+ /**
140
+ * Boolean to flag the js to use motion ui classes or not. Default to true for backwards compatability.
141
+ * @option
142
+ * @example true
143
+ */
144
+ useMUI: true
145
+ };
146
+ /**
147
+ * Initializes the plugin by creating jQuery collections, setting attributes, and starting the animation.
148
+ * @function
149
+ * @private
150
+ */
151
+ Orbit.prototype._init = function(){
152
+ this.$wrapper = this.$element.find('.' + this.options.containerClass);
153
+ this.$slides = this.$element.find('.' + this.options.slideClass);
154
+ var $images = this.$element.find('img'),
155
+ initActive = this.$slides.filter('.is-active');
156
+
157
+ if(!initActive.length){
158
+ this.$slides.eq(0).addClass('is-active');
159
+ }
160
+ if(!this.options.useMUI){
161
+ this.$slides.addClass('no-motionui');
162
+ }
163
+ if($images.length){
164
+ Foundation.onImagesLoaded($images, this._prepareForOrbit.bind(this));
165
+ }else{
166
+ this._prepareForOrbit();//hehe
167
+ }
168
+
169
+ if(this.options.bullets){
170
+ this._loadBullets();
171
+ }
172
+
173
+ this._events();
174
+
175
+ if(this.options.autoPlay){
176
+ this.geoSync();
177
+ }
178
+ if(this.options.accessible){ // allow wrapper to be focusable to enable arrow navigation
179
+ this.$wrapper.attr('tabindex', 0);
180
+ }
181
+ };
182
+ /**
183
+ * Creates a jQuery collection of bullets, if they are being used.
184
+ * @function
185
+ * @private
186
+ */
187
+ Orbit.prototype._loadBullets = function(){
188
+ this.$bullets = this.$element.find('.' + this.options.boxOfBullets).find('button');
189
+ };
190
+ /**
191
+ * Sets a `timer` object on the orbit, and starts the counter for the next slide.
192
+ * @function
193
+ */
194
+ Orbit.prototype.geoSync = function(){
195
+ var _this = this;
196
+ this.timer = new Foundation.Timer(
197
+ this.$element,
198
+ {duration: this.options.timerDelay,
199
+ infinite: false},
200
+ function(){
201
+ _this.changeSlide(true);
202
+ });
203
+ this.timer.start();
204
+ };
205
+ /**
206
+ * Sets wrapper and slide heights for the orbit.
207
+ * @function
208
+ * @private
209
+ */
210
+ Orbit.prototype._prepareForOrbit = function(){
211
+ var _this = this;
212
+ this._setWrapperHeight(function(max){
213
+ _this._setSlideHeight(max);
214
+ });
215
+ };
216
+ /**
217
+ * Calulates the height of each slide in the collection, and uses the tallest one for the wrapper height.
218
+ * @function
219
+ * @private
220
+ * @param {Function} cb - a callback function to fire when complete.
221
+ */
222
+ Orbit.prototype._setWrapperHeight = function(cb){//rewrite this to `for` loop
223
+ var max = 0, temp, counter = 0;
224
+
225
+ this.$slides.each(function(){
226
+ temp = this.getBoundingClientRect().height;
227
+ $(this).attr('data-slide', counter);
228
+
229
+ if(counter){//if not the first slide, set css position and display property
230
+ $(this).css({'position': 'relative', 'display': 'none'});
231
+ }
232
+ max = temp > max ? temp : max;
233
+ counter++;
234
+ });
235
+
236
+ if(counter === this.$slides.length){
237
+ this.$wrapper.css({'height': max});//only change the wrapper height property once.
238
+ cb(max);//fire callback with max height dimension.
239
+ }
240
+ };
241
+ /**
242
+ * Sets the max-height of each slide.
243
+ * @function
244
+ * @private
245
+ */
246
+ Orbit.prototype._setSlideHeight = function(height){
247
+ this.$slides.each(function(){
248
+ $(this).css('max-height', height);
249
+ });
250
+ };
251
+ /**
252
+ * Adds event listeners to basically everything within the element.
253
+ * @function
254
+ * @private
255
+ */
256
+ Orbit.prototype._events = function(){
257
+ var _this = this;
258
+
259
+ //***************************************
260
+ //**Now using custom event - thanks to:**
261
+ //** Yohai Ararat of Toronto **
262
+ //***************************************
263
+ if(this.options.swipe){
264
+ this.$slides.off('swipeleft.zf.orbit swiperight.zf.orbit')
265
+ .on('swipeleft.zf.orbit', function(e){
266
+ e.preventDefault();
267
+ _this.changeSlide(true);
268
+ }).on('swiperight.zf.orbit', function(e){
269
+ e.preventDefault();
270
+ _this.changeSlide(false);
271
+ });
272
+ }
273
+ //***************************************
274
+
275
+ if(this.options.autoPlay){
276
+ this.$slides.on('click.zf.orbit', function(){
277
+ _this.$element.data('clickedOn', _this.$element.data('clickedOn') ? false : true);
278
+ _this.timer[_this.$element.data('clickedOn') ? 'pause' : 'start']();
279
+ });
280
+ if(this.options.pauseOnHover){
281
+ this.$element.on('mouseenter.zf.orbit', function(){
282
+ _this.timer.pause();
283
+ }).on('mouseleave.zf.orbit', function(){
284
+ if(!_this.$element.data('clickedOn')){
285
+ _this.timer.start();
286
+ }
287
+ });
288
+ }
289
+ }
290
+
291
+ if(this.options.navButtons){
292
+ var $controls = this.$element.find('.' + this.options.nextClass + ', .' + this.options.prevClass);
293
+ $controls.attr('tabindex', 0)
294
+ //also need to handle enter/return and spacebar key presses
295
+ .on('click.zf.orbit touchend.zf.orbit', function(){
296
+ _this.changeSlide($(this).hasClass(_this.options.nextClass));
297
+ });
298
+ }
299
+
300
+ if(this.options.bullets){
301
+ this.$bullets.on('click.zf.orbit touchend.zf.orbit', function(){
302
+ if(/is-active/g.test(this.className)){ return false; }//if this is active, kick out of function.
303
+ var idx = $(this).data('slide'),
304
+ ltr = idx > _this.$slides.filter('.is-active').data('slide'),
305
+ $slide = _this.$slides.eq(idx);
306
+
307
+ _this.changeSlide(ltr, $slide, idx);
308
+ });
309
+ }
310
+
311
+ this.$wrapper.add(this.$bullets).on('keydown.zf.orbit', function(e){
312
+ // handle keyboard event with keyboard util
313
+ Foundation.Keyboard.handleKey(e, 'Orbit', {
314
+ next: function() {
315
+ _this.changeSlide(true);
316
+ },
317
+ previous: function() {
318
+ _this.changeSlide(false);
319
+ },
320
+ handled: function() { // if bullet is focused, make sure focus moves
321
+ if ($(e.target).is(_this.$bullets)) {
322
+ _this.$bullets.filter('.is-active').focus();
323
+ }
324
+ }
325
+ });
326
+ });
327
+ };
328
+ /**
329
+ * Changes the current slide to a new one.
330
+ * @function
331
+ * @param {Boolean} isLTR - flag if the slide should move left to right.
332
+ * @param {jQuery} chosenSlide - the jQuery element of the slide to show next, if one is selected.
333
+ * @param {Number} idx - the index of the new slide in its collection, if one chosen.
334
+ * @fires Orbit#slidechange
335
+ */
336
+ Orbit.prototype.changeSlide = function(isLTR, chosenSlide, idx){
337
+ var $curSlide = this.$slides.filter('.is-active').eq(0);
338
+
339
+ if(/mui/g.test($curSlide[0].className)){ return false; }//if the slide is currently animating, kick out of the function
340
+
341
+ var $firstSlide = this.$slides.first(),
342
+ $lastSlide = this.$slides.last(),
343
+ dirIn = isLTR ? 'Right' : 'Left',
344
+ dirOut = isLTR ? 'Left' : 'Right',
345
+ _this = this,
346
+ $newSlide;
347
+
348
+ if(!chosenSlide){//most of the time, this will be auto played or clicked from the navButtons.
349
+ $newSlide = isLTR ? //if wrapping enabled, check to see if there is a `next` or `prev` sibling, if not, select the first or last slide to fill in. if wrapping not enabled, attempt to select `next` or `prev`, if there's nothing there, the function will kick out on next step. CRAZY NESTED TERNARIES!!!!!
350
+ (this.options.infiniteWrap ? $curSlide.next('.' + this.options.slideClass).length ? $curSlide.next('.' + this.options.slideClass) : $firstSlide : $curSlide.next('.' + this.options.slideClass))//pick next slide if moving left to right
351
+ :
352
+ (this.options.infiniteWrap ? $curSlide.prev('.' + this.options.slideClass).length ? $curSlide.prev('.' + this.options.slideClass) : $lastSlide : $curSlide.prev('.' + this.options.slideClass));//pick prev slide if moving right to left
353
+ }else{
354
+ $newSlide = chosenSlide;
355
+ }
356
+ if($newSlide.length){
357
+ if(this.options.bullets){
358
+ idx = idx || this.$slides.index($newSlide);//grab index to update bullets
359
+ this._updateBullets(idx);
360
+ }
361
+ if(this.options.useMUI){
362
+
363
+ Foundation.Motion.animateIn(
364
+ $newSlide.addClass('is-active').css({'position': 'absolute', 'top': 0}),
365
+ this.options['animInFrom' + dirIn],
366
+ function(){
367
+ $newSlide.css({'position': 'relative', 'display': 'block'})
368
+ .attr('aria-live', 'polite');
369
+ });
370
+
371
+ Foundation.Motion.animateOut(
372
+ $curSlide.removeClass('is-active'),
373
+ this.options['animOutTo' + dirOut],
374
+ function(){
375
+ $curSlide.removeAttr('aria-live');
376
+ if(_this.options.autoPlay){
377
+ _this.timer.restart();
378
+ }
379
+ //do stuff?
380
+ });
381
+ }else{
382
+ $curSlide.removeClass('is-active is-in').removeAttr('aria-live').hide();
383
+ $newSlide.addClass('is-active is-in').attr('aria-live', 'polite').show();
384
+ if(this.options.autoPlay){
385
+ this.timer.restart();
386
+ }
387
+ }
388
+ /**
389
+ * Triggers when the slide has finished animating in.
390
+ * @event Orbit#slidechange
391
+ */
392
+ this.$element.trigger('slidechange.zf.orbit', [$newSlide]);
393
+ }
394
+ };
395
+ /**
396
+ * Updates the active state of the bullets, if displayed.
397
+ * @function
398
+ * @private
399
+ * @param {Number} idx - the index of the current slide.
400
+ */
401
+ Orbit.prototype._updateBullets = function(idx){
402
+ var $oldBullet = this.$element.find('.' + this.options.boxOfBullets)
403
+ .find('.is-active').removeClass('is-active').blur(),
404
+ span = $oldBullet.find('span:last').detach(),
405
+ $newBullet = this.$bullets.eq(idx).addClass('is-active').append(span);
406
+ };
407
+ /**
408
+ * Destroys the carousel and hides the element.
409
+ * @function
410
+ */
411
+ Orbit.prototype.destroy = function(){
412
+ delete this.timer;
413
+ this.$element.off('.zf.orbit').find('*').off('.zf.orbit').end().hide();
414
+ Foundation.unregisterPlugin(this);
415
+ };
416
+
417
+ Foundation.plugin(Orbit, 'Orbit');
418
+
419
+ }(jQuery, window.Foundation);
@@ -0,0 +1,145 @@
1
+ /**
2
+ * ResponsiveMenu module.
3
+ * @module foundation.responsiveMenu
4
+ * @requires foundation.util.triggers
5
+ * @requires foundation.util.mediaQuery
6
+ * @requires foundation.util.accordionMenu
7
+ * @requires foundation.util.drilldown
8
+ * @requires foundation.util.dropdown-menu
9
+ */
10
+ !function(Foundation, $) {
11
+ 'use strict';
12
+
13
+ // The plugin matches the plugin classes with these plugin instances.
14
+ var MenuPlugins = {
15
+ dropdown: {
16
+ cssClass: 'dropdown',
17
+ plugin: Foundation._plugins['dropdown-menu'] || null
18
+ },
19
+ drilldown: {
20
+ cssClass: 'drilldown',
21
+ plugin: Foundation._plugins['drilldown'] || null
22
+ },
23
+ accordion: {
24
+ cssClass: 'accordion-menu',
25
+ plugin: Foundation._plugins['accordion-menu'] || null
26
+ }
27
+ };
28
+
29
+ // [PH] Media queries
30
+ var phMedia = {
31
+ small: '(min-width: 0px)',
32
+ medium: '(min-width: 640px)'
33
+ };
34
+
35
+ /**
36
+ * Creates a new instance of a responsive menu.
37
+ * @class
38
+ * @fires ResponsiveMenu#init
39
+ * @param {jQuery} element - jQuery object to make into a dropdown menu.
40
+ * @param {Object} options - Overrides to the default plugin settings.
41
+ */
42
+ function ResponsiveMenu(element) {
43
+ this.$element = $(element);
44
+ this.rules = this.$element.data('responsive-menu');
45
+ this.currentMq = null;
46
+ this.currentPlugin = null;
47
+
48
+ this._init();
49
+ this._events();
50
+
51
+ Foundation.registerPlugin(this, 'ResponsiveMenu');
52
+ }
53
+
54
+ ResponsiveMenu.defaults = {};
55
+
56
+ /**
57
+ * Initializes the Menu by parsing the classes from the 'data-ResponsiveMenu' attribute on the element.
58
+ * @function
59
+ * @private
60
+ */
61
+ ResponsiveMenu.prototype._init = function() {
62
+ var rulesTree = {};
63
+
64
+ // Parse rules from "classes" in data attribute
65
+ var rules = this.rules.split(' ');
66
+
67
+ // Iterate through every rule found
68
+ for (var i = 0; i < rules.length; i++) {
69
+ var rule = rules[i].split('-');
70
+ var ruleSize = rule.length > 1 ? rule[0] : 'small';
71
+ var rulePlugin = rule.length > 1 ? rule[1] : rule[0];
72
+
73
+ if (MenuPlugins[rulePlugin] !== null) {
74
+ rulesTree[ruleSize] = MenuPlugins[rulePlugin];
75
+ }
76
+ }
77
+
78
+ this.rules = rulesTree;
79
+
80
+ if (!$.isEmptyObject(rulesTree)) {
81
+ this._checkMediaQueries();
82
+ }
83
+ };
84
+
85
+ /**
86
+ * Initializes events for the Menu.
87
+ * @function
88
+ * @private
89
+ */
90
+ ResponsiveMenu.prototype._events = function() {
91
+ var _this = this;
92
+
93
+ $(window).on('changed.zf.mediaquery', function() {
94
+ _this._checkMediaQueries();
95
+ });
96
+ // $(window).on('resize.zf.ResponsiveMenu', function() {
97
+ // _this._checkMediaQueries();
98
+ // });
99
+ };
100
+
101
+ /**
102
+ * Checks the current screen width against available media queries. If the media query has changed, and the plugin needed has changed, the plugins will swap out.
103
+ * @function
104
+ * @private
105
+ */
106
+ ResponsiveMenu.prototype._checkMediaQueries = function() {
107
+ var matchedMq, _this = this;
108
+ // Iterate through each rule and find the last matching rule
109
+ $.each(this.rules, function(key) {
110
+ if (Foundation.MediaQuery.atLeast(key)) {
111
+ matchedMq = key;
112
+ }
113
+ });
114
+
115
+ // No match? No dice
116
+ if (!matchedMq) return;
117
+
118
+ // Plugin already initialized? We good
119
+ if (this.currentPlugin instanceof this.rules[matchedMq].plugin) return;
120
+
121
+ // Remove existing plugin-specific CSS classes
122
+ $.each(MenuPlugins, function(key, value) {
123
+ _this.$element.removeClass(value.cssClass);
124
+ });
125
+
126
+ // Add the CSS class for the new plugin
127
+ this.$element.addClass(this.rules[matchedMq].cssClass);
128
+
129
+ // Create an instance of the new plugin
130
+ if (this.currentPlugin) this.currentPlugin.destroy();
131
+ this.currentPlugin = new this.rules[matchedMq].plugin(this.$element, {});
132
+ };
133
+
134
+ /**
135
+ * Destroys the instance of the current plugin on this element, as well as the window resize handler that switches the plugins out.
136
+ * @function
137
+ */
138
+ ResponsiveMenu.prototype.destroy = function() {
139
+ this.currentPlugin.destroy();
140
+ $(window).off('.zf.ResponsiveMenu');
141
+ Foundation.unregisterPlugin(this);
142
+ };
143
+ Foundation.plugin(ResponsiveMenu, 'ResponsiveMenu');
144
+
145
+ }(Foundation, jQuery);