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