foundation-rails 6.1.1.3 → 6.1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/bower.json +2 -2
  4. data/lib/foundation/rails/version.rb +1 -1
  5. data/lib/generators/foundation/templates/_settings.scss +4 -2
  6. data/vendor/assets/js/foundation.abide.js +2 -2
  7. data/vendor/assets/js/foundation.accordion.js +16 -14
  8. data/vendor/assets/js/foundation.accordionMenu.js +20 -23
  9. data/vendor/assets/js/foundation.core.js +6 -8
  10. data/vendor/assets/js/foundation.drilldown.js +4 -4
  11. data/vendor/assets/js/foundation.dropdown.js +5 -3
  12. data/vendor/assets/js/foundation.dropdownMenu.js +8 -9
  13. data/vendor/assets/js/foundation.equalizer.js +6 -6
  14. data/vendor/assets/js/foundation.interchange.js +14 -5
  15. data/vendor/assets/js/foundation.magellan.js +25 -11
  16. data/vendor/assets/js/foundation.offcanvas.js +9 -4
  17. data/vendor/assets/js/foundation.orbit.js +306 -304
  18. data/vendor/assets/js/foundation.responsiveMenu.js +0 -6
  19. data/vendor/assets/js/foundation.reveal.js +63 -27
  20. data/vendor/assets/js/foundation.slider.js +65 -39
  21. data/vendor/assets/js/foundation.tabs.js +6 -7
  22. data/vendor/assets/js/foundation.tooltip.js +3 -3
  23. data/vendor/assets/js/foundation.util.nest.js +2 -3
  24. data/vendor/assets/js/foundation.util.timerAndImageLoader.js +4 -0
  25. data/vendor/assets/js/foundation.util.touch.js +17 -4
  26. data/vendor/assets/js/foundation.util.triggers.js +5 -3
  27. data/vendor/assets/scss/_global.scss +12 -2
  28. data/vendor/assets/scss/components/_accordion.scss +1 -5
  29. data/vendor/assets/scss/components/_button-group.scss +17 -2
  30. data/vendor/assets/scss/components/_button.scss +1 -8
  31. data/vendor/assets/scss/components/_drilldown.scss +4 -4
  32. data/vendor/assets/scss/components/_dropdown-menu.scss +88 -75
  33. data/vendor/assets/scss/components/_dropdown.scss +3 -2
  34. data/vendor/assets/scss/components/_media-object.scss +1 -1
  35. data/vendor/assets/scss/components/_menu.scss +7 -2
  36. data/vendor/assets/scss/components/_off-canvas.scss +0 -4
  37. data/vendor/assets/scss/components/_orbit.scss +1 -1
  38. data/vendor/assets/scss/components/_pagination.scss +6 -2
  39. data/vendor/assets/scss/components/_progress-bar.scss +14 -9
  40. data/vendor/assets/scss/components/_reveal.scss +8 -6
  41. data/vendor/assets/scss/components/_slider.scss +7 -0
  42. data/vendor/assets/scss/components/_table.scss +77 -64
  43. data/vendor/assets/scss/components/_title-bar.scss +4 -0
  44. data/vendor/assets/scss/components/_tooltip.scss +10 -2
  45. data/vendor/assets/scss/components/_top-bar.scss +13 -8
  46. data/vendor/assets/scss/forms/_error.scss +1 -1
  47. data/vendor/assets/scss/forms/_fieldset.scss +1 -0
  48. data/vendor/assets/scss/forms/_forms.scss +8 -9
  49. data/vendor/assets/scss/forms/_input-group.scss +1 -0
  50. data/vendor/assets/scss/forms/_select.scss +3 -1
  51. data/vendor/assets/scss/forms/_text.scss +1 -1
  52. data/vendor/assets/scss/foundation.scss +1 -1
  53. data/vendor/assets/scss/grid/_classes.scss +12 -2
  54. data/vendor/assets/scss/grid/_column.scss +1 -1
  55. data/vendor/assets/scss/grid/_flex-grid.scss +20 -3
  56. data/vendor/assets/scss/grid/_gutter.scss +1 -1
  57. data/vendor/assets/scss/grid/_position.scss +1 -0
  58. data/vendor/assets/scss/grid/_row.scss +1 -0
  59. data/vendor/assets/scss/settings/_settings.scss +4 -2
  60. data/vendor/assets/scss/util/_breakpoint.scss +10 -10
  61. data/vendor/assets/scss/util/_mixins.scss +6 -2
  62. data/vendor/assets/scss/util/_unit.scss +1 -1
  63. metadata +2 -2
@@ -142,27 +142,36 @@
142
142
  Interchange.prototype.replace = function(path) {
143
143
  if (this.currentPath === path) return;
144
144
 
145
- var _this = this;
145
+ var _this = this,
146
+ trigger = 'replaced.zf.interchange';
146
147
 
147
148
  // Replacing images
148
149
  if (this.$element[0].nodeName === 'IMG') {
149
150
  this.$element.attr('src', path).load(function() {
150
151
  _this.currentPath = path;
151
- });
152
+ })
153
+ .trigger(trigger);
152
154
  }
153
155
  // Replacing background images
154
156
  else if (path.match(/\.(gif|jpg|jpeg|tiff|png)([?#].*)?/i)) {
155
- this.$element.css({ 'background-image': 'url('+path+')' });
157
+ this.$element.css({ 'background-image': 'url('+path+')' })
158
+ .trigger(trigger);
156
159
  }
157
160
  // Replacing HTML
158
161
  else {
159
162
  $.get(path, function(response) {
160
- _this.$element.html(response);
163
+ _this.$element.html(response)
164
+ .trigger(trigger);
161
165
  $(response).foundation();
162
166
  _this.currentPath = path;
163
167
  });
164
168
  }
165
- this.$element.trigger('replaced.zf.interchange');
169
+
170
+ /**
171
+ * Fires when content in an Interchange element is done being loaded.
172
+ * @event Interchange#replaced
173
+ */
174
+ // this.$element.trigger('replaced.zf.interchange');
166
175
  };
167
176
  /**
168
177
  * Destroys an instance of interchange.
@@ -114,8 +114,12 @@
114
114
  duration: _this.options.animationDuration,
115
115
  easing: _this.options.animationEasing
116
116
  };
117
-
118
117
  $(window).one('load', function(){
118
+ if(_this.options.deepLinking){
119
+ if(location.hash){
120
+ _this.scrollToLoc(location.hash);
121
+ }
122
+ }
119
123
  _this.calcPoints();
120
124
  _this._updateActive();
121
125
  });
@@ -125,16 +129,26 @@
125
129
  'scrollme.zf.trigger': this._updateActive.bind(this)
126
130
  }).on('click.zf.magellan', 'a[href^="#"]', function(e) {
127
131
  e.preventDefault();
128
- var arrival = this.getAttribute('href'),
129
- scrollPos = $(arrival).offset().top - _this.options.threshold / 2 - _this.options.barOffset;
130
-
131
- // requestAnimationFrame is disabled for this plugin currently
132
- // Foundation.Move(_this.options.animationDuration, $body, function(){
133
- $body.stop(true).animate({
134
- scrollTop: scrollPos
135
- }, opts);
136
- });
137
- // });
132
+ var arrival = this.getAttribute('href');
133
+ _this.scrollToLoc(arrival);
134
+ });
135
+ };
136
+ /**
137
+ * Function to scroll to a given location on the page.
138
+ * @param {String} loc - a properly formatted jQuery id selector.
139
+ * @example '#foo'
140
+ * @function
141
+ */
142
+ Magellan.prototype.scrollToLoc = function(loc){
143
+ var scrollPos = $(loc).offset().top - this.options.threshold / 2 - this.options.barOffset;
144
+
145
+ $(document.body).stop(true).animate({
146
+ scrollTop: scrollPos
147
+ },
148
+ {
149
+ duration: this.options.animationDuration,
150
+ easiing: this.options.animationEasing
151
+ });
138
152
  };
139
153
  /**
140
154
  * Calls necessary functions to update Magellan upon DOM change
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * OffCanvas module.
3
3
  * @module foundation.offcanvas
4
+ * @requires foundation.util.mediaQuery
4
5
  * @requires foundation.util.triggers
5
6
  * @requires foundation.util.motion
6
7
  */
@@ -55,7 +56,7 @@ OffCanvas.defaults = {
55
56
  */
56
57
  // isSticky: false,
57
58
  /**
58
- * Allow the offcanvas to remain open for certain breakpoints. Can be used with `isSticky`.
59
+ * Allow the offcanvas to remain open for certain breakpoints.
59
60
  * @option
60
61
  * @example false
61
62
  */
@@ -140,8 +141,7 @@ OffCanvas.prototype._events = function() {
140
141
  'keydown.zf.offcanvas': this._handleKeyboard.bind(this)
141
142
  });
142
143
 
143
- if (this.$exiter.length) {
144
- var _this = this;
144
+ if (this.options.closeOnClick && this.$exiter.length) {
145
145
  this.$exiter.on({'click.zf.offcanvas': this.close.bind(this)});
146
146
  }
147
147
  };
@@ -235,7 +235,9 @@ OffCanvas.prototype.open = function(event, trigger) {
235
235
  this.$element.attr('aria-hidden', 'false')
236
236
  .trigger('opened.zf.offcanvas');
237
237
 
238
-
238
+ if(this.options.closeOnClick){
239
+ this.$exiter.addClass('is-visible');
240
+ }
239
241
  if(trigger){
240
242
  this.$lastTrigger = trigger.attr('aria-expanded', 'true');
241
243
  }
@@ -318,6 +320,9 @@ OffCanvas.prototype.close = function(cb) {
318
320
  // $(window).off('scroll.zf.offcanvas');
319
321
  // }, this.options.transitionTime);
320
322
  // }
323
+ if(this.options.closeOnClick){
324
+ this.$exiter.removeClass('is-visible');
325
+ }
321
326
 
322
327
  this.$lastTrigger.attr('aria-expanded', 'false');
323
328
  if(this.options.trapFocus){
@@ -1,19 +1,19 @@
1
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
- */
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
9
  !function($, Foundation){
10
10
  'use strict';
11
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
- */
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
17
  function Orbit(element, options){
18
18
  this.$element = element;
19
19
  this.options = $.extend({}, Orbit.defaults, this.$element.data(), options);
@@ -22,137 +22,137 @@
22
22
 
23
23
  Foundation.registerPlugin(this, 'Orbit');
24
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
- }
25
+ 'ltr': {
26
+ 'ARROW_RIGHT': 'next',
27
+ 'ARROW_LEFT': 'previous'
28
+ },
29
+ 'rtl': {
30
+ 'ARROW_LEFT': 'next',
31
+ 'ARROW_RIGHT': 'previous'
32
+ }
33
33
  });
34
34
  }
35
35
  Orbit.defaults = {
36
36
  /**
37
- * Tells the JS to loadBullets.
38
- * @option
39
- * @example true
40
- */
37
+ * Tells the JS to loadBullets.
38
+ * @option
39
+ * @example true
40
+ */
41
41
  bullets: true,
42
42
  /**
43
- * Tells the JS to apply event listeners to nav buttons
44
- * @option
45
- * @example true
46
- */
43
+ * Tells the JS to apply event listeners to nav buttons
44
+ * @option
45
+ * @example true
46
+ */
47
47
  navButtons: true,
48
48
  /**
49
- * motion-ui animation class to apply
50
- * @option
51
- * @example 'slide-in-right'
52
- */
49
+ * motion-ui animation class to apply
50
+ * @option
51
+ * @example 'slide-in-right'
52
+ */
53
53
  animInFromRight: 'slide-in-right',
54
54
  /**
55
- * motion-ui animation class to apply
56
- * @option
57
- * @example 'slide-out-right'
58
- */
55
+ * motion-ui animation class to apply
56
+ * @option
57
+ * @example 'slide-out-right'
58
+ */
59
59
  animOutToRight: 'slide-out-right',
60
60
  /**
61
- * motion-ui animation class to apply
62
- * @option
63
- * @example 'slide-in-left'
64
- *
65
- */
61
+ * motion-ui animation class to apply
62
+ * @option
63
+ * @example 'slide-in-left'
64
+ *
65
+ */
66
66
  animInFromLeft: 'slide-in-left',
67
67
  /**
68
- * motion-ui animation class to apply
69
- * @option
70
- * @example 'slide-out-left'
71
- */
68
+ * motion-ui animation class to apply
69
+ * @option
70
+ * @example 'slide-out-left'
71
+ */
72
72
  animOutToLeft: 'slide-out-left',
73
73
  /**
74
- * Allows Orbit to automatically animate on page load.
75
- * @option
76
- * @example true
77
- */
74
+ * Allows Orbit to automatically animate on page load.
75
+ * @option
76
+ * @example true
77
+ */
78
78
  autoPlay: true,
79
79
  /**
80
- * Amount of time, in ms, between slide transitions
81
- * @option
82
- * @example 5000
83
- */
80
+ * Amount of time, in ms, between slide transitions
81
+ * @option
82
+ * @example 5000
83
+ */
84
84
  timerDelay: 5000,
85
85
  /**
86
- * Allows Orbit to infinitely loop through the slides
87
- * @option
88
- * @example true
89
- */
86
+ * Allows Orbit to infinitely loop through the slides
87
+ * @option
88
+ * @example true
89
+ */
90
90
  infiniteWrap: true,
91
91
  /**
92
- * Allows the Orbit slides to bind to swipe events for mobile, requires an additional util library
93
- * @option
94
- * @example true
95
- */
92
+ * Allows the Orbit slides to bind to swipe events for mobile, requires an additional util library
93
+ * @option
94
+ * @example true
95
+ */
96
96
  swipe: true,
97
97
  /**
98
- * Allows the timing function to pause animation on hover.
99
- * @option
100
- * @example true
101
- */
98
+ * Allows the timing function to pause animation on hover.
99
+ * @option
100
+ * @example true
101
+ */
102
102
  pauseOnHover: true,
103
103
  /**
104
- * Allows Orbit to bind keyboard events to the slider, to animate frames with arrow keys
105
- * @option
106
- * @example true
107
- */
104
+ * Allows Orbit to bind keyboard events to the slider, to animate frames with arrow keys
105
+ * @option
106
+ * @example true
107
+ */
108
108
  accessible: true,
109
109
  /**
110
- * Class applied to the container of Orbit
111
- * @option
112
- * @example 'orbit-container'
113
- */
110
+ * Class applied to the container of Orbit
111
+ * @option
112
+ * @example 'orbit-container'
113
+ */
114
114
  containerClass: 'orbit-container',
115
115
  /**
116
- * Class applied to individual slides.
117
- * @option
118
- * @example 'orbit-slide'
119
- */
116
+ * Class applied to individual slides.
117
+ * @option
118
+ * @example 'orbit-slide'
119
+ */
120
120
  slideClass: 'orbit-slide',
121
121
  /**
122
- * Class applied to the bullet container. You're welcome.
123
- * @option
124
- * @example 'orbit-bullets'
125
- */
122
+ * Class applied to the bullet container. You're welcome.
123
+ * @option
124
+ * @example 'orbit-bullets'
125
+ */
126
126
  boxOfBullets: 'orbit-bullets',
127
127
  /**
128
- * Class applied to the `next` navigation button.
129
- * @option
130
- * @example 'orbit-next'
131
- */
128
+ * Class applied to the `next` navigation button.
129
+ * @option
130
+ * @example 'orbit-next'
131
+ */
132
132
  nextClass: 'orbit-next',
133
133
  /**
134
- * Class applied to the `previous` navigation button.
135
- * @option
136
- * @example 'orbit-previous'
137
- */
134
+ * Class applied to the `previous` navigation button.
135
+ * @option
136
+ * @example 'orbit-previous'
137
+ */
138
138
  prevClass: 'orbit-previous',
139
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
- */
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
144
  useMUI: true
145
145
  };
146
146
  /**
147
- * Initializes the plugin by creating jQuery collections, setting attributes, and starting the animation.
148
- * @function
149
- * @private
150
- */
147
+ * Initializes the plugin by creating jQuery collections, setting attributes, and starting the animation.
148
+ * @function
149
+ * @private
150
+ */
151
151
  Orbit.prototype._init = function(){
152
152
  this.$wrapper = this.$element.find('.' + this.options.containerClass);
153
153
  this.$slides = this.$element.find('.' + this.options.slideClass);
154
154
  var $images = this.$element.find('img'),
155
- initActive = this.$slides.filter('.is-active');
155
+ initActive = this.$slides.filter('.is-active');
156
156
 
157
157
  if(!initActive.length){
158
158
  this.$slides.eq(0).addClass('is-active');
@@ -172,7 +172,7 @@
172
172
 
173
173
  this._events();
174
174
 
175
- if(this.options.autoPlay){
175
+ if(this.options.autoPlay && this.$slides.length > 1){
176
176
  this.geoSync();
177
177
  }
178
178
  if(this.options.accessible){ // allow wrapper to be focusable to enable arrow navigation
@@ -180,240 +180,242 @@
180
180
  }
181
181
  };
182
182
  /**
183
- * Creates a jQuery collection of bullets, if they are being used.
184
- * @function
185
- * @private
186
- */
183
+ * Creates a jQuery collection of bullets, if they are being used.
184
+ * @function
185
+ * @private
186
+ */
187
187
  Orbit.prototype._loadBullets = function(){
188
188
  this.$bullets = this.$element.find('.' + this.options.boxOfBullets).find('button');
189
189
  };
190
190
  /**
191
- * Sets a `timer` object on the orbit, and starts the counter for the next slide.
192
- * @function
193
- */
191
+ * Sets a `timer` object on the orbit, and starts the counter for the next slide.
192
+ * @function
193
+ */
194
194
  Orbit.prototype.geoSync = function(){
195
195
  var _this = this;
196
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;
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
224
 
225
- this.$slides.each(function(){
226
- temp = this.getBoundingClientRect().height;
227
- $(this).attr('data-slide', counter);
225
+ this.$slides.each(function(){
226
+ temp = this.getBoundingClientRect().height;
227
+ $(this).attr('data-slide', counter);
228
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
- });
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
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;
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
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
- //***************************************
259
+ //***************************************
260
+ //**Now using custom event - thanks to:**
261
+ //** Yohai Ararat of Toronto **
262
+ //***************************************
263
+ if(this.$slides.length > 1){
274
264
 
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();
265
+ if(this.options.swipe){
266
+ this.$slides.off('swipeleft.zf.orbit swiperight.zf.orbit')
267
+ .on('swipeleft.zf.orbit', function(e){
268
+ e.preventDefault();
269
+ _this.changeSlide(true);
270
+ }).on('swiperight.zf.orbit', function(e){
271
+ e.preventDefault();
272
+ _this.changeSlide(false);
273
+ });
286
274
  }
287
- });
288
- }
289
- }
275
+ //***************************************
290
276
 
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
- }
277
+ if(this.options.autoPlay){
278
+ this.$slides.on('click.zf.orbit', function(){
279
+ _this.$element.data('clickedOn', _this.$element.data('clickedOn') ? false : true);
280
+ _this.timer[_this.$element.data('clickedOn') ? 'pause' : 'start']();
281
+ });
282
+ if(this.options.pauseOnHover){
283
+ this.$element.on('mouseenter.zf.orbit', function(){
284
+ _this.timer.pause();
285
+ }).on('mouseleave.zf.orbit', function(){
286
+ if(!_this.$element.data('clickedOn')){
287
+ _this.timer.start();
288
+ }
289
+ });
290
+ }
291
+ }
299
292
 
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);
293
+ if(this.options.navButtons){
294
+ var $controls = this.$element.find('.' + this.options.nextClass + ', .' + this.options.prevClass);
295
+ $controls.attr('tabindex', 0)
296
+ //also need to handle enter/return and spacebar key presses
297
+ .on('click.zf.orbit touchend.zf.orbit', function(){
298
+ _this.changeSlide($(this).hasClass(_this.options.nextClass));
299
+ });
300
+ }
306
301
 
307
- _this.changeSlide(ltr, $slide, idx);
308
- });
309
- }
302
+ if(this.options.bullets){
303
+ this.$bullets.on('click.zf.orbit touchend.zf.orbit', function(){
304
+ if(/is-active/g.test(this.className)){ return false; }//if this is active, kick out of function.
305
+ var idx = $(this).data('slide'),
306
+ ltr = idx > _this.$slides.filter('.is-active').data('slide'),
307
+ $slide = _this.$slides.eq(idx);
310
308
 
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();
309
+ _this.changeSlide(ltr, $slide, idx);
310
+ });
323
311
  }
312
+
313
+ this.$wrapper.add(this.$bullets).on('keydown.zf.orbit', function(e){
314
+ // handle keyboard event with keyboard util
315
+ Foundation.Keyboard.handleKey(e, 'Orbit', {
316
+ next: function() {
317
+ _this.changeSlide(true);
318
+ },
319
+ previous: function() {
320
+ _this.changeSlide(false);
321
+ },
322
+ handled: function() { // if bullet is focused, make sure focus moves
323
+ if ($(e.target).is(_this.$bullets)) {
324
+ _this.$bullets.filter('.is-active').focus();
325
+ }
326
+ }
327
+ });
328
+ });
324
329
  }
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);
330
+ };
331
+ /**
332
+ * Changes the current slide to a new one.
333
+ * @function
334
+ * @param {Boolean} isLTR - flag if the slide should move left to right.
335
+ * @param {jQuery} chosenSlide - the jQuery element of the slide to show next, if one is selected.
336
+ * @param {Number} idx - the index of the new slide in its collection, if one chosen.
337
+ * @fires Orbit#slidechange
338
+ */
339
+ Orbit.prototype.changeSlide = function(isLTR, chosenSlide, idx){
340
+ var $curSlide = this.$slides.filter('.is-active').eq(0);
338
341
 
339
- if(/mui/g.test($curSlide[0].className)){ return false; }//if the slide is currently animating, kick out of the function
342
+ if(/mui/g.test($curSlide[0].className)){ return false; }//if the slide is currently animating, kick out of the function
340
343
 
341
- var $firstSlide = this.$slides.first(),
344
+ var $firstSlide = this.$slides.first(),
342
345
  $lastSlide = this.$slides.last(),
343
346
  dirIn = isLTR ? 'Right' : 'Left',
344
347
  dirOut = isLTR ? 'Left' : 'Right',
345
348
  _this = this,
346
349
  $newSlide;
347
350
 
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){
351
+ if(!chosenSlide){//most of the time, this will be auto played or clicked from the navButtons.
352
+ $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!!!!!
353
+ (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
354
+ :
355
+ (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
356
+ }else{
357
+ $newSlide = chosenSlide;
358
+ }
359
+ if($newSlide.length){
360
+ if(this.options.bullets){
361
+ idx = idx || this.$slides.index($newSlide);//grab index to update bullets
362
+ this._updateBullets(idx);
363
+ }
364
+ if(this.options.useMUI){
362
365
 
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
- });
366
+ Foundation.Motion.animateIn(
367
+ $newSlide.addClass('is-active').css({'position': 'absolute', 'top': 0}),
368
+ this.options['animInFrom' + dirIn],
369
+ function(){
370
+ $newSlide.css({'position': 'relative', 'display': 'block'})
371
+ .attr('aria-live', 'polite');
372
+ });
370
373
 
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();
374
+ Foundation.Motion.animateOut(
375
+ $curSlide.removeClass('is-active'),
376
+ this.options['animOutTo' + dirOut],
377
+ function(){
378
+ $curSlide.removeAttr('aria-live');
379
+ if(_this.options.autoPlay && !_this.timer.isPaused){
380
+ _this.timer.restart();
381
+ }
382
+ //do stuff?
383
+ });
384
+ }else{
385
+ $curSlide.removeClass('is-active is-in').removeAttr('aria-live').hide();
386
+ $newSlide.addClass('is-active is-in').attr('aria-live', 'polite').show();
387
+ if(this.options.autoPlay && !this.timer.isPaused){
388
+ this.timer.restart();
389
+ }
390
+ }
391
+ /**
392
+ * Triggers when the slide has finished animating in.
393
+ * @event Orbit#slidechange
394
+ */
395
+ this.$element.trigger('slidechange.zf.orbit', [$newSlide]);
378
396
  }
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
- };
397
+ };
398
+ /**
399
+ * Updates the active state of the bullets, if displayed.
400
+ * @function
401
+ * @private
402
+ * @param {Number} idx - the index of the current slide.
403
+ */
404
+ Orbit.prototype._updateBullets = function(idx){
405
+ var $oldBullet = this.$element.find('.' + this.options.boxOfBullets)
406
+ .find('.is-active').removeClass('is-active').blur(),
407
+ span = $oldBullet.find('span:last').detach(),
408
+ $newBullet = this.$bullets.eq(idx).addClass('is-active').append(span);
409
+ };
410
+ /**
411
+ * Destroys the carousel and hides the element.
412
+ * @function
413
+ */
414
+ Orbit.prototype.destroy = function(){
415
+ this.$element.off('.zf.orbit').find('*').off('.zf.orbit').end().hide();
416
+ Foundation.unregisterPlugin(this);
417
+ };
416
418
 
417
- Foundation.plugin(Orbit, 'Orbit');
419
+ Foundation.plugin(Orbit, 'Orbit');
418
420
 
419
- }(jQuery, window.Foundation);
421
+ }(jQuery, window.Foundation);