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
@@ -1,3 +1,7 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
!function($) {
|
4
|
+
|
1
5
|
/**
|
2
6
|
* DropdownMenu module.
|
3
7
|
* @module foundation.dropdown-menu
|
@@ -5,9 +9,8 @@
|
|
5
9
|
* @requires foundation.util.box
|
6
10
|
* @requires foundation.util.nest
|
7
11
|
*/
|
8
|
-
!function($, Foundation){
|
9
|
-
'use strict';
|
10
12
|
|
13
|
+
class DropdownMenu {
|
11
14
|
/**
|
12
15
|
* Creates a new instance of DropdownMenu.
|
13
16
|
* @class
|
@@ -15,7 +18,7 @@
|
|
15
18
|
* @param {jQuery} element - jQuery object to make into a dropdown menu.
|
16
19
|
* @param {Object} options - Overrides to the default plugin settings.
|
17
20
|
*/
|
18
|
-
|
21
|
+
constructor(element, options) {
|
19
22
|
this.$element = element;
|
20
23
|
this.options = $.extend({}, DropdownMenu.defaults, this.$element.data(), options);
|
21
24
|
|
@@ -34,95 +37,24 @@
|
|
34
37
|
});
|
35
38
|
}
|
36
39
|
|
37
|
-
/**
|
38
|
-
* Default settings for plugin
|
39
|
-
*/
|
40
|
-
DropdownMenu.defaults = {
|
41
|
-
/**
|
42
|
-
* Disallows hover events from opening submenus
|
43
|
-
* @option
|
44
|
-
* @example false
|
45
|
-
*/
|
46
|
-
disableHover: false,
|
47
|
-
/**
|
48
|
-
* Allow a submenu to automatically close on a mouseleave event, if not clicked open.
|
49
|
-
* @option
|
50
|
-
* @example true
|
51
|
-
*/
|
52
|
-
autoclose: true,
|
53
|
-
/**
|
54
|
-
* Amount of time to delay opening a submenu on hover event.
|
55
|
-
* @option
|
56
|
-
* @example 50
|
57
|
-
*/
|
58
|
-
hoverDelay: 50,
|
59
|
-
/**
|
60
|
-
* Allow a submenu to open/remain open on parent click event. Allows cursor to move away from menu.
|
61
|
-
* @option
|
62
|
-
* @example true
|
63
|
-
*/
|
64
|
-
clickOpen: false,
|
65
|
-
/**
|
66
|
-
* Amount of time to delay closing a submenu on a mouseleave event.
|
67
|
-
* @option
|
68
|
-
* @example 500
|
69
|
-
*/
|
70
|
-
|
71
|
-
closingTime: 500,
|
72
|
-
/**
|
73
|
-
* Position of the menu relative to what direction the submenus should open. Handled by JS.
|
74
|
-
* @option
|
75
|
-
* @example 'left'
|
76
|
-
*/
|
77
|
-
alignment: 'left',
|
78
|
-
/**
|
79
|
-
* Allow clicks on the body to close any open submenus.
|
80
|
-
* @option
|
81
|
-
* @example true
|
82
|
-
*/
|
83
|
-
closeOnClick: true,
|
84
|
-
/**
|
85
|
-
* Class applied to vertical oriented menus, Foundation default is `vertical`. Update this if using your own class.
|
86
|
-
* @option
|
87
|
-
* @example 'vertical'
|
88
|
-
*/
|
89
|
-
verticalClass: 'vertical',
|
90
|
-
/**
|
91
|
-
* Class applied to right-side oriented menus, Foundation default is `align-right`. Update this if using your own class.
|
92
|
-
* @option
|
93
|
-
* @example 'align-right'
|
94
|
-
*/
|
95
|
-
rightClass: 'align-right',
|
96
|
-
/**
|
97
|
-
* Boolean to force overide the clicking of links to perform default action, on second touch event for mobile.
|
98
|
-
* @option
|
99
|
-
* @example false
|
100
|
-
*/
|
101
|
-
forceFollow: true
|
102
|
-
};
|
103
40
|
/**
|
104
41
|
* Initializes the plugin, and calls _prepareMenu
|
105
42
|
* @private
|
106
43
|
* @function
|
107
44
|
*/
|
108
|
-
|
45
|
+
_init() {
|
109
46
|
var subs = this.$element.find('li.is-dropdown-submenu-parent');
|
110
47
|
this.$element.children('.is-dropdown-submenu-parent').children('.is-dropdown-submenu').addClass('first-sub');
|
111
48
|
|
112
49
|
this.$menuItems = this.$element.find('[role="menuitem"]');
|
113
50
|
this.$tabs = this.$element.children('[role="menuitem"]');
|
114
|
-
this.isVert = this.$element.hasClass(this.options.verticalClass);
|
115
51
|
this.$tabs.find('ul.is-dropdown-submenu').addClass(this.options.verticalClass);
|
116
52
|
|
117
|
-
if(this.$element.hasClass(this.options.rightClass) || this.options.alignment === 'right' || Foundation.rtl()){
|
53
|
+
if (this.$element.hasClass(this.options.rightClass) || this.options.alignment === 'right' || Foundation.rtl()) {
|
118
54
|
this.options.alignment = 'right';
|
119
|
-
subs.addClass('
|
120
|
-
}else{
|
121
|
-
subs.addClass('
|
122
|
-
}
|
123
|
-
if(!this.isVert){
|
124
|
-
this.$tabs.filter('.is-dropdown-submenu-parent').removeClass('is-right-arrow is-left-arrow opens-right opens-left')
|
125
|
-
.addClass('is-down-arrow');
|
55
|
+
subs.addClass('opens-left');
|
56
|
+
} else {
|
57
|
+
subs.addClass('opens-right');
|
126
58
|
}
|
127
59
|
this.changed = false;
|
128
60
|
this._events();
|
@@ -132,62 +64,62 @@
|
|
132
64
|
* @private
|
133
65
|
* @function
|
134
66
|
*/
|
135
|
-
|
67
|
+
_events() {
|
136
68
|
var _this = this,
|
137
69
|
hasTouch = 'ontouchstart' in window || (typeof window.ontouchstart !== 'undefined'),
|
138
70
|
parClass = 'is-dropdown-submenu-parent';
|
139
71
|
|
140
|
-
if(this.options.clickOpen || hasTouch){
|
141
|
-
this.$menuItems.on('click.zf.dropdownmenu touchstart.zf.dropdownmenu', function(e){
|
142
|
-
var $elem = $(e.target).parentsUntil('ul',
|
72
|
+
if (this.options.clickOpen || hasTouch) {
|
73
|
+
this.$menuItems.on('click.zf.dropdownmenu touchstart.zf.dropdownmenu', function(e) {
|
74
|
+
var $elem = $(e.target).parentsUntil('ul', `.${parClass}`),
|
143
75
|
hasSub = $elem.hasClass(parClass),
|
144
76
|
hasClicked = $elem.attr('data-is-click') === 'true',
|
145
77
|
$sub = $elem.children('.is-dropdown-submenu');
|
146
78
|
|
147
|
-
if(hasSub){
|
148
|
-
if(hasClicked){
|
149
|
-
if(!_this.options.closeOnClick || (!_this.options.clickOpen && !hasTouch) || (_this.options.forceFollow && hasTouch)){ return; }
|
150
|
-
else{
|
79
|
+
if (hasSub) {
|
80
|
+
if (hasClicked) {
|
81
|
+
if (!_this.options.closeOnClick || (!_this.options.clickOpen && !hasTouch) || (_this.options.forceFollow && hasTouch)) { return; }
|
82
|
+
else {
|
151
83
|
e.stopImmediatePropagation();
|
152
84
|
e.preventDefault();
|
153
85
|
_this._hide($elem);
|
154
86
|
}
|
155
|
-
}else{
|
87
|
+
} else {
|
156
88
|
e.preventDefault();
|
157
89
|
e.stopImmediatePropagation();
|
158
90
|
_this._show($elem.children('.is-dropdown-submenu'));
|
159
|
-
$elem.add($elem.parentsUntil(_this.$element,
|
91
|
+
$elem.add($elem.parentsUntil(_this.$element, `.${parClass}`)).attr('data-is-click', true);
|
160
92
|
}
|
161
|
-
}else{ return; }
|
93
|
+
} else { return; }
|
162
94
|
});
|
163
95
|
}
|
164
96
|
|
165
|
-
if(!this.options.disableHover){
|
166
|
-
this.$menuItems.on('mouseenter.zf.dropdownmenu', function(e){
|
97
|
+
if (!this.options.disableHover) {
|
98
|
+
this.$menuItems.on('mouseenter.zf.dropdownmenu', function(e) {
|
167
99
|
e.stopImmediatePropagation();
|
168
100
|
var $elem = $(this),
|
169
101
|
hasSub = $elem.hasClass(parClass);
|
170
102
|
|
171
|
-
if(hasSub){
|
103
|
+
if (hasSub) {
|
172
104
|
clearTimeout(_this.delay);
|
173
|
-
_this.delay = setTimeout(function(){
|
105
|
+
_this.delay = setTimeout(function() {
|
174
106
|
_this._show($elem.children('.is-dropdown-submenu'));
|
175
107
|
}, _this.options.hoverDelay);
|
176
108
|
}
|
177
|
-
}).on('mouseleave.zf.dropdownmenu', function(e){
|
109
|
+
}).on('mouseleave.zf.dropdownmenu', function(e) {
|
178
110
|
var $elem = $(this),
|
179
111
|
hasSub = $elem.hasClass(parClass);
|
180
|
-
if(hasSub && _this.options.autoclose){
|
181
|
-
if($elem.attr('data-is-click') === 'true' && _this.options.clickOpen){ return false; }
|
112
|
+
if (hasSub && _this.options.autoclose) {
|
113
|
+
if ($elem.attr('data-is-click') === 'true' && _this.options.clickOpen) { return false; }
|
182
114
|
|
183
115
|
clearTimeout(_this.delay);
|
184
|
-
_this.delay = setTimeout(function(){
|
116
|
+
_this.delay = setTimeout(function() {
|
185
117
|
_this._hide($elem);
|
186
118
|
}, _this.options.closingTime);
|
187
119
|
}
|
188
120
|
});
|
189
121
|
}
|
190
|
-
this.$menuItems.on('keydown.zf.dropdownmenu', function(e){
|
122
|
+
this.$menuItems.on('keydown.zf.dropdownmenu', function(e) {
|
191
123
|
var $element = $(e.target).parentsUntil('ul', '[role="menuitem"]'),
|
192
124
|
isTab = _this.$tabs.index($element) > -1,
|
193
125
|
$elements = isTab ? _this.$tabs : $element.siblings('li').add($element),
|
@@ -208,10 +140,10 @@
|
|
208
140
|
$prevElement.children('a:first').focus();
|
209
141
|
}, openSub = function() {
|
210
142
|
var $sub = $element.children('ul.is-dropdown-submenu');
|
211
|
-
if($sub.length){
|
143
|
+
if ($sub.length) {
|
212
144
|
_this._show($sub);
|
213
145
|
$element.find('li > a:first').focus();
|
214
|
-
}else{ return; }
|
146
|
+
} else { return; }
|
215
147
|
}, closeSub = function() {
|
216
148
|
//if ($element.is(':first-child')) {
|
217
149
|
var close = $element.parent('ul').parent('li');
|
@@ -276,24 +208,26 @@
|
|
276
208
|
Foundation.Keyboard.handleKey(e, 'DropdownMenu', functions);
|
277
209
|
|
278
210
|
});
|
279
|
-
}
|
211
|
+
}
|
212
|
+
|
280
213
|
/**
|
281
214
|
* Adds an event handler to the body to close any dropdowns on a click.
|
282
215
|
* @function
|
283
216
|
* @private
|
284
217
|
*/
|
285
|
-
|
218
|
+
_addBodyHandler() {
|
286
219
|
var $body = $(document.body),
|
287
220
|
_this = this;
|
288
221
|
$body.off('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu')
|
289
|
-
.on('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu', function(e){
|
222
|
+
.on('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu', function(e) {
|
290
223
|
var $link = _this.$element.find(e.target);
|
291
|
-
if($link.length){ return; }
|
224
|
+
if ($link.length) { return; }
|
292
225
|
|
293
226
|
_this._hide();
|
294
227
|
$body.off('mouseup.zf.dropdownmenu touchend.zf.dropdownmenu');
|
295
228
|
});
|
296
|
-
}
|
229
|
+
}
|
230
|
+
|
297
231
|
/**
|
298
232
|
* Opens a dropdown pane, and checks for collisions first.
|
299
233
|
* @param {jQuery} $sub - ul element that is a submenu to show
|
@@ -301,8 +235,8 @@
|
|
301
235
|
* @private
|
302
236
|
* @fires DropdownMenu#show
|
303
237
|
*/
|
304
|
-
|
305
|
-
var idx = this.$tabs.index(this.$tabs.filter(function(i, el){
|
238
|
+
_show($sub) {
|
239
|
+
var idx = this.$tabs.index(this.$tabs.filter(function(i, el) {
|
306
240
|
return $(el).find($sub).length > 0;
|
307
241
|
}));
|
308
242
|
var $sibs = $sub.parent('li.is-dropdown-submenu-parent').siblings('li.is-dropdown-submenu-parent');
|
@@ -311,24 +245,25 @@
|
|
311
245
|
.parent('li.is-dropdown-submenu-parent').addClass('is-active')
|
312
246
|
.attr({'aria-expanded': true});
|
313
247
|
var clear = Foundation.Box.ImNotTouchingYou($sub, null, true);
|
314
|
-
if(!clear){
|
248
|
+
if (!clear) {
|
315
249
|
var oldClass = this.options.alignment === 'left' ? '-right' : '-left',
|
316
250
|
$parentLi = $sub.parent('.is-dropdown-submenu-parent');
|
317
|
-
$parentLi.removeClass(
|
251
|
+
$parentLi.removeClass(`opens${oldClass}`).addClass(`opens-${this.options.alignment}`);
|
318
252
|
clear = Foundation.Box.ImNotTouchingYou($sub, null, true);
|
319
|
-
if(!clear){
|
320
|
-
$parentLi.removeClass(
|
253
|
+
if (!clear) {
|
254
|
+
$parentLi.removeClass(`opens-${this.options.alignment}`).addClass('opens-inner');
|
321
255
|
}
|
322
256
|
this.changed = true;
|
323
257
|
}
|
324
258
|
$sub.css('visibility', '');
|
325
|
-
if(this.options.closeOnClick){ this._addBodyHandler(); }
|
259
|
+
if (this.options.closeOnClick) { this._addBodyHandler(); }
|
326
260
|
/**
|
327
261
|
* Fires when the new dropdown pane is visible.
|
328
262
|
* @event DropdownMenu#show
|
329
263
|
*/
|
330
264
|
this.$element.trigger('show.zf.dropdownmenu', [$sub]);
|
331
|
-
}
|
265
|
+
}
|
266
|
+
|
332
267
|
/**
|
333
268
|
* Hides a single, currently open dropdown pane, if passed a parameter, otherwise, hides everything.
|
334
269
|
* @function
|
@@ -336,21 +271,21 @@
|
|
336
271
|
* @param {Number} idx - index of the $tabs collection to hide
|
337
272
|
* @private
|
338
273
|
*/
|
339
|
-
|
274
|
+
_hide($elem, idx) {
|
340
275
|
var $toClose;
|
341
|
-
if($elem && $elem.length){
|
276
|
+
if ($elem && $elem.length) {
|
342
277
|
$toClose = $elem;
|
343
|
-
}else if(idx !== undefined){
|
344
|
-
$toClose = this.$tabs.not(function(i, el){
|
278
|
+
} else if (idx !== undefined) {
|
279
|
+
$toClose = this.$tabs.not(function(i, el) {
|
345
280
|
return i === idx;
|
346
281
|
});
|
347
282
|
}
|
348
|
-
else{
|
283
|
+
else {
|
349
284
|
$toClose = this.$element;
|
350
285
|
}
|
351
286
|
var somethingToClose = $toClose.hasClass('is-active') || $toClose.find('.is-active').length > 0;
|
352
287
|
|
353
|
-
if(somethingToClose){
|
288
|
+
if (somethingToClose) {
|
354
289
|
$toClose.find('li.is-active').add($toClose).attr({
|
355
290
|
'aria-expanded': false,
|
356
291
|
'data-is-click': false
|
@@ -360,11 +295,11 @@
|
|
360
295
|
'aria-hidden': true
|
361
296
|
}).removeClass('js-dropdown-active');
|
362
297
|
|
363
|
-
if(this.changed || $toClose.find('opens-inner').length){
|
298
|
+
if (this.changed || $toClose.find('opens-inner').length) {
|
364
299
|
var oldClass = this.options.alignment === 'left' ? 'right' : 'left';
|
365
300
|
$toClose.find('li.is-dropdown-submenu-parent').add($toClose)
|
366
|
-
.removeClass(
|
367
|
-
.addClass(
|
301
|
+
.removeClass(`opens-inner opens-${this.options.alignment}`)
|
302
|
+
.addClass(`opens-${oldClass}`);
|
368
303
|
this.changed = false;
|
369
304
|
}
|
370
305
|
/**
|
@@ -373,18 +308,89 @@
|
|
373
308
|
*/
|
374
309
|
this.$element.trigger('hide.zf.dropdownmenu', [$toClose]);
|
375
310
|
}
|
376
|
-
}
|
311
|
+
}
|
312
|
+
|
377
313
|
/**
|
378
314
|
* Destroys the plugin.
|
379
315
|
* @function
|
380
316
|
*/
|
381
|
-
|
317
|
+
destroy() {
|
382
318
|
this.$menuItems.off('.zf.dropdownmenu').removeAttr('data-is-click')
|
383
319
|
.removeClass('is-right-arrow is-left-arrow is-down-arrow opens-right opens-left opens-inner');
|
384
320
|
$(document.body).off('.zf.dropdownmenu');
|
385
321
|
Foundation.Nest.Burn(this.$element, 'dropdown');
|
386
322
|
Foundation.unregisterPlugin(this);
|
387
|
-
}
|
323
|
+
}
|
324
|
+
}
|
325
|
+
|
326
|
+
/**
|
327
|
+
* Default settings for plugin
|
328
|
+
*/
|
329
|
+
DropdownMenu.defaults = {
|
330
|
+
/**
|
331
|
+
* Disallows hover events from opening submenus
|
332
|
+
* @option
|
333
|
+
* @example false
|
334
|
+
*/
|
335
|
+
disableHover: false,
|
336
|
+
/**
|
337
|
+
* Allow a submenu to automatically close on a mouseleave event, if not clicked open.
|
338
|
+
* @option
|
339
|
+
* @example true
|
340
|
+
*/
|
341
|
+
autoclose: true,
|
342
|
+
/**
|
343
|
+
* Amount of time to delay opening a submenu on hover event.
|
344
|
+
* @option
|
345
|
+
* @example 50
|
346
|
+
*/
|
347
|
+
hoverDelay: 50,
|
348
|
+
/**
|
349
|
+
* Allow a submenu to open/remain open on parent click event. Allows cursor to move away from menu.
|
350
|
+
* @option
|
351
|
+
* @example true
|
352
|
+
*/
|
353
|
+
clickOpen: false,
|
354
|
+
/**
|
355
|
+
* Amount of time to delay closing a submenu on a mouseleave event.
|
356
|
+
* @option
|
357
|
+
* @example 500
|
358
|
+
*/
|
359
|
+
|
360
|
+
closingTime: 500,
|
361
|
+
/**
|
362
|
+
* Position of the menu relative to what direction the submenus should open. Handled by JS.
|
363
|
+
* @option
|
364
|
+
* @example 'left'
|
365
|
+
*/
|
366
|
+
alignment: 'left',
|
367
|
+
/**
|
368
|
+
* Allow clicks on the body to close any open submenus.
|
369
|
+
* @option
|
370
|
+
* @example true
|
371
|
+
*/
|
372
|
+
closeOnClick: true,
|
373
|
+
/**
|
374
|
+
* Class applied to vertical oriented menus, Foundation default is `vertical`. Update this if using your own class.
|
375
|
+
* @option
|
376
|
+
* @example 'vertical'
|
377
|
+
*/
|
378
|
+
verticalClass: 'vertical',
|
379
|
+
/**
|
380
|
+
* Class applied to right-side oriented menus, Foundation default is `align-right`. Update this if using your own class.
|
381
|
+
* @option
|
382
|
+
* @example 'align-right'
|
383
|
+
*/
|
384
|
+
rightClass: 'align-right',
|
385
|
+
/**
|
386
|
+
* Boolean to force overide the clicking of links to perform default action, on second touch event for mobile.
|
387
|
+
* @option
|
388
|
+
* @example false
|
389
|
+
*/
|
390
|
+
forceFollow: true
|
391
|
+
};
|
392
|
+
|
393
|
+
// Window exports
|
394
|
+
Foundation.plugin(DropdownMenu, 'DropdownMenu');
|
388
395
|
|
389
|
-
|
390
|
-
}(jQuery, window.Foundation);
|
396
|
+
}(jQuery);
|
@@ -1,6 +1,13 @@
|
|
1
|
-
|
2
|
-
'use strict';
|
1
|
+
'use strict';
|
3
2
|
|
3
|
+
!function($) {
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Equalizer module.
|
7
|
+
* @module foundation.equalizer
|
8
|
+
*/
|
9
|
+
|
10
|
+
class Equalizer {
|
4
11
|
/**
|
5
12
|
* Creates a new instance of Equalizer.
|
6
13
|
* @class
|
@@ -8,7 +15,7 @@
|
|
8
15
|
* @param {Object} element - jQuery object to add the trigger to.
|
9
16
|
* @param {Object} options - Overrides to the default plugin settings.
|
10
17
|
*/
|
11
|
-
|
18
|
+
constructor(element, options){
|
12
19
|
this.$element = element;
|
13
20
|
this.options = $.extend({}, Equalizer.defaults, this.$element.data(), options);
|
14
21
|
|
@@ -17,37 +24,13 @@
|
|
17
24
|
Foundation.registerPlugin(this, 'Equalizer');
|
18
25
|
}
|
19
26
|
|
20
|
-
/**
|
21
|
-
* Default settings for plugin
|
22
|
-
*/
|
23
|
-
Equalizer.defaults = {
|
24
|
-
/**
|
25
|
-
* Enable height equalization when stacked on smaller screens.
|
26
|
-
* @option
|
27
|
-
* @example true
|
28
|
-
*/
|
29
|
-
equalizeOnStack: true,
|
30
|
-
/**
|
31
|
-
* Enable height equalization row by row.
|
32
|
-
* @option
|
33
|
-
* @example false
|
34
|
-
*/
|
35
|
-
equalizeByRow: false,
|
36
|
-
/**
|
37
|
-
* String representing the minimum breakpoint size the plugin should equalize heights on.
|
38
|
-
* @option
|
39
|
-
* @example 'medium'
|
40
|
-
*/
|
41
|
-
equalizeOn: ''
|
42
|
-
};
|
43
|
-
|
44
27
|
/**
|
45
28
|
* Initializes the Equalizer plugin and calls functions to get equalizer functioning on load.
|
46
29
|
* @private
|
47
30
|
*/
|
48
|
-
|
31
|
+
_init() {
|
49
32
|
var eqId = this.$element.attr('data-equalizer') || '';
|
50
|
-
var $watched = this.$element.find(
|
33
|
+
var $watched = this.$element.find(`[data-equalizer-watch="${eqId}"]`);
|
51
34
|
|
52
35
|
this.$watched = $watched.length ? $watched : this.$element.find('[data-equalizer-watch]');
|
53
36
|
this.$element.attr('data-resize', (eqId || Foundation.GetYoDigits(6, 'eq')));
|
@@ -71,21 +54,22 @@
|
|
71
54
|
this._reflow();
|
72
55
|
}
|
73
56
|
}
|
57
|
+
}
|
74
58
|
|
75
|
-
};
|
76
59
|
/**
|
77
60
|
* Removes event listeners if the breakpoint is too small.
|
78
61
|
* @private
|
79
62
|
*/
|
80
|
-
|
63
|
+
_pauseEvents() {
|
81
64
|
this.isOn = false;
|
82
65
|
this.$element.off('.zf.equalizer resizeme.zf.trigger');
|
83
|
-
}
|
66
|
+
}
|
67
|
+
|
84
68
|
/**
|
85
69
|
* Initializes events for Equalizer.
|
86
70
|
* @private
|
87
71
|
*/
|
88
|
-
|
72
|
+
_events() {
|
89
73
|
var _this = this;
|
90
74
|
this._pauseEvents();
|
91
75
|
if(this.hasNested){
|
@@ -96,12 +80,13 @@
|
|
96
80
|
this.$element.on('resizeme.zf.trigger', this._reflow.bind(this));
|
97
81
|
}
|
98
82
|
this.isOn = true;
|
99
|
-
}
|
83
|
+
}
|
84
|
+
|
100
85
|
/**
|
101
86
|
* Checks the current breakpoint to the minimum required size.
|
102
87
|
* @private
|
103
88
|
*/
|
104
|
-
|
89
|
+
_checkMQ() {
|
105
90
|
var tooSmall = !Foundation.MediaQuery.atLeast(this.options.equalizeOn);
|
106
91
|
if(tooSmall){
|
107
92
|
if(this.isOn){
|
@@ -114,19 +99,21 @@
|
|
114
99
|
}
|
115
100
|
}
|
116
101
|
return tooSmall;
|
117
|
-
}
|
102
|
+
}
|
103
|
+
|
118
104
|
/**
|
119
105
|
* A noop version for the plugin
|
120
106
|
* @private
|
121
107
|
*/
|
122
|
-
|
108
|
+
_killswitch() {
|
123
109
|
return;
|
124
|
-
}
|
110
|
+
}
|
111
|
+
|
125
112
|
/**
|
126
113
|
* Calls necessary functions to update Equalizer upon DOM change
|
127
114
|
* @private
|
128
115
|
*/
|
129
|
-
|
116
|
+
_reflow() {
|
130
117
|
if(!this.options.equalizeOnStack){
|
131
118
|
if(this._isStacked()){
|
132
119
|
this.$watched.css('height', 'auto');
|
@@ -138,33 +125,36 @@
|
|
138
125
|
}else{
|
139
126
|
this.getHeights(this.applyHeight.bind(this));
|
140
127
|
}
|
141
|
-
}
|
128
|
+
}
|
129
|
+
|
142
130
|
/**
|
143
131
|
* Manually determines if the first 2 elements are *NOT* stacked.
|
144
132
|
* @private
|
145
133
|
*/
|
146
|
-
|
134
|
+
_isStacked() {
|
147
135
|
return this.$watched[0].offsetTop !== this.$watched[1].offsetTop;
|
148
|
-
}
|
136
|
+
}
|
137
|
+
|
149
138
|
/**
|
150
139
|
* Finds the outer heights of children contained within an Equalizer parent and returns them in an array
|
151
140
|
* @param {Function} cb - A non-optional callback to return the heights array to.
|
152
141
|
* @returns {Array} heights - An array of heights of children within Equalizer container
|
153
142
|
*/
|
154
|
-
|
143
|
+
getHeights(cb) {
|
155
144
|
var heights = [];
|
156
145
|
for(var i = 0, len = this.$watched.length; i < len; i++){
|
157
146
|
this.$watched[i].style.height = 'auto';
|
158
147
|
heights.push(this.$watched[i].offsetHeight);
|
159
148
|
}
|
160
149
|
cb(heights);
|
161
|
-
}
|
150
|
+
}
|
151
|
+
|
162
152
|
/**
|
163
153
|
* Finds the outer heights of children contained within an Equalizer parent and returns them in an array
|
164
154
|
* @param {Function} cb - A non-optional callback to return the heights array to.
|
165
155
|
* @returns {Array} groups - An array of heights of children within Equalizer container grouped by row with element,height and max as last child
|
166
156
|
*/
|
167
|
-
|
157
|
+
getHeightsByRow(cb) {
|
168
158
|
var lastElTopOffset = this.$watched.first().offset().top,
|
169
159
|
groups = [],
|
170
160
|
group = 0;
|
@@ -188,14 +178,15 @@
|
|
188
178
|
groups[j].push(max);
|
189
179
|
}
|
190
180
|
cb(groups);
|
191
|
-
}
|
181
|
+
}
|
182
|
+
|
192
183
|
/**
|
193
184
|
* Changes the CSS height property of each child in an Equalizer parent to match the tallest
|
194
185
|
* @param {array} heights - An array of heights of children within Equalizer container
|
195
186
|
* @fires Equalizer#preequalized
|
196
187
|
* @fires Equalizer#postequalized
|
197
188
|
*/
|
198
|
-
|
189
|
+
applyHeight(heights) {
|
199
190
|
var max = Math.max.apply(null, heights);
|
200
191
|
/**
|
201
192
|
* Fires before the heights are applied
|
@@ -210,7 +201,8 @@
|
|
210
201
|
* @event Equalizer#postequalized
|
211
202
|
*/
|
212
203
|
this.$element.trigger('postequalized.zf.equalizer');
|
213
|
-
}
|
204
|
+
}
|
205
|
+
|
214
206
|
/**
|
215
207
|
* Changes the CSS height property of each child in an Equalizer parent to match the tallest by row
|
216
208
|
* @param {array} groups - An array of heights of children within Equalizer container grouped by row with element,height and max as last child
|
@@ -219,7 +211,7 @@
|
|
219
211
|
* @fires Equalizer#postequalizedRow
|
220
212
|
* @fires Equalizer#postequalized
|
221
213
|
*/
|
222
|
-
|
214
|
+
applyHeightByRow(groups) {
|
223
215
|
/**
|
224
216
|
* Fires before the heights are applied
|
225
217
|
*/
|
@@ -249,26 +241,45 @@
|
|
249
241
|
* Fires when the heights have been applied
|
250
242
|
*/
|
251
243
|
this.$element.trigger('postequalized.zf.equalizer');
|
252
|
-
}
|
244
|
+
}
|
245
|
+
|
253
246
|
/**
|
254
247
|
* Destroys an instance of Equalizer.
|
255
248
|
* @function
|
256
249
|
*/
|
257
|
-
|
250
|
+
destroy() {
|
258
251
|
this._pauseEvents();
|
259
252
|
this.$watched.css('height', 'auto');
|
260
253
|
|
261
254
|
Foundation.unregisterPlugin(this);
|
262
|
-
}
|
255
|
+
}
|
256
|
+
}
|
263
257
|
|
264
|
-
|
258
|
+
/**
|
259
|
+
* Default settings for plugin
|
260
|
+
*/
|
261
|
+
Equalizer.defaults = {
|
262
|
+
/**
|
263
|
+
* Enable height equalization when stacked on smaller screens.
|
264
|
+
* @option
|
265
|
+
* @example true
|
266
|
+
*/
|
267
|
+
equalizeOnStack: true,
|
268
|
+
/**
|
269
|
+
* Enable height equalization row by row.
|
270
|
+
* @option
|
271
|
+
* @example false
|
272
|
+
*/
|
273
|
+
equalizeByRow: false,
|
274
|
+
/**
|
275
|
+
* String representing the minimum breakpoint size the plugin should equalize heights on.
|
276
|
+
* @option
|
277
|
+
* @example 'medium'
|
278
|
+
*/
|
279
|
+
equalizeOn: ''
|
280
|
+
};
|
265
281
|
|
266
|
-
|
267
|
-
|
268
|
-
module.exports = Equalizer;
|
269
|
-
if (typeof define === 'function')
|
270
|
-
define(['foundation'], function() {
|
271
|
-
return Equalizer;
|
272
|
-
});
|
282
|
+
// Window exports
|
283
|
+
Foundation.plugin(Equalizer, 'Equalizer');
|
273
284
|
|
274
|
-
}(
|
285
|
+
}(jQuery);
|