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,12 +1,15 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
!function($) {
|
4
|
+
|
1
5
|
/**
|
2
6
|
* Tabs module.
|
3
7
|
* @module foundation.tabs
|
4
8
|
* @requires foundation.util.keyboard
|
5
9
|
* @requires foundation.util.timerAndImageLoader if tabs contain images
|
6
10
|
*/
|
7
|
-
!function($, Foundation) {
|
8
|
-
'use strict';
|
9
11
|
|
12
|
+
class Tabs {
|
10
13
|
/**
|
11
14
|
* Creates a new instance of tabs.
|
12
15
|
* @class
|
@@ -14,7 +17,7 @@
|
|
14
17
|
* @param {jQuery} element - jQuery object to make into tabs.
|
15
18
|
* @param {Object} options - Overrides to the default plugin settings.
|
16
19
|
*/
|
17
|
-
|
20
|
+
constructor(element, options) {
|
18
21
|
this.$element = element;
|
19
22
|
this.options = $.extend({}, Tabs.defaults, this.$element.data(), options);
|
20
23
|
|
@@ -32,65 +35,23 @@
|
|
32
35
|
});
|
33
36
|
}
|
34
37
|
|
35
|
-
Tabs.defaults = {
|
36
|
-
// /**
|
37
|
-
// * Allows the JS to alter the url of the window. Not yet implemented.
|
38
|
-
// */
|
39
|
-
// deepLinking: false,
|
40
|
-
// /**
|
41
|
-
// * If deepLinking is enabled, allows the window to scroll to content if window is loaded with a hash including a tab-pane id
|
42
|
-
// */
|
43
|
-
// scrollToContent: false,
|
44
|
-
/**
|
45
|
-
* Allows the window to scroll to content of active pane on load if set to true.
|
46
|
-
* @option
|
47
|
-
* @example false
|
48
|
-
*/
|
49
|
-
autoFocus: false,
|
50
|
-
/**
|
51
|
-
* Allows keyboard input to 'wrap' around the tab links.
|
52
|
-
* @option
|
53
|
-
* @example true
|
54
|
-
*/
|
55
|
-
wrapOnKeys: true,
|
56
|
-
/**
|
57
|
-
* Allows the tab content panes to match heights if set to true.
|
58
|
-
* @option
|
59
|
-
* @example false
|
60
|
-
*/
|
61
|
-
matchHeight: false,
|
62
|
-
/**
|
63
|
-
* Class applied to `li`'s in tab link list.
|
64
|
-
* @option
|
65
|
-
* @example 'tabs-title'
|
66
|
-
*/
|
67
|
-
linkClass: 'tabs-title',
|
68
|
-
// contentClass: 'tabs-content',
|
69
|
-
/**
|
70
|
-
* Class applied to the content containers.
|
71
|
-
* @option
|
72
|
-
* @example 'tabs-panel'
|
73
|
-
*/
|
74
|
-
panelClass: 'tabs-panel'
|
75
|
-
};
|
76
|
-
|
77
38
|
/**
|
78
39
|
* Initializes the tabs by showing and focusing (if autoFocus=true) the preset active tab.
|
79
40
|
* @private
|
80
41
|
*/
|
81
|
-
|
42
|
+
_init() {
|
82
43
|
var _this = this;
|
83
44
|
|
84
|
-
this.$tabTitles = this.$element.find(
|
85
|
-
this.$tabContent = $(
|
45
|
+
this.$tabTitles = this.$element.find(`.${this.options.linkClass}`);
|
46
|
+
this.$tabContent = $(`[data-tabs-content="${this.$element[0].id}"]`);
|
86
47
|
|
87
48
|
this.$tabTitles.each(function(){
|
88
49
|
var $elem = $(this),
|
89
50
|
$link = $elem.find('a'),
|
90
51
|
isActive = $elem.hasClass('is-active'),
|
91
52
|
hash = $link[0].hash.slice(1),
|
92
|
-
linkId = $link[0].id ? $link[0].id : hash
|
93
|
-
$tabContent = $(
|
53
|
+
linkId = $link[0].id ? $link[0].id : `${hash}-label`,
|
54
|
+
$tabContent = $(`#${hash}`);
|
94
55
|
|
95
56
|
$elem.attr({'role': 'presentation'});
|
96
57
|
|
@@ -111,56 +72,63 @@
|
|
111
72
|
$link.focus();
|
112
73
|
}
|
113
74
|
});
|
114
|
-
|
75
|
+
|
76
|
+
if(this.options.matchHeight) {
|
115
77
|
var $images = this.$tabContent.find('img');
|
116
|
-
|
78
|
+
|
79
|
+
if ($images.length) {
|
117
80
|
Foundation.onImagesLoaded($images, this._setHeight.bind(this));
|
118
|
-
}else{
|
81
|
+
} else {
|
119
82
|
this._setHeight();
|
120
83
|
}
|
121
84
|
}
|
85
|
+
|
122
86
|
this._events();
|
123
|
-
}
|
87
|
+
}
|
88
|
+
|
124
89
|
/**
|
125
90
|
* Adds event handlers for items within the tabs.
|
126
91
|
* @private
|
127
92
|
*/
|
128
|
-
|
93
|
+
_events() {
|
129
94
|
this._addKeyHandler();
|
130
95
|
this._addClickHandler();
|
131
|
-
|
96
|
+
|
97
|
+
if (this.options.matchHeight) {
|
132
98
|
$(window).on('changed.zf.mediaquery', this._setHeight.bind(this));
|
133
99
|
}
|
134
|
-
}
|
100
|
+
}
|
135
101
|
|
136
102
|
/**
|
137
103
|
* Adds click handlers for items within the tabs.
|
138
104
|
* @private
|
139
105
|
*/
|
140
|
-
|
106
|
+
_addClickHandler() {
|
141
107
|
var _this = this;
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
108
|
+
|
109
|
+
this.$element
|
110
|
+
.off('click.zf.tabs')
|
111
|
+
.on('click.zf.tabs', `.${this.options.linkClass}`, function(e){
|
112
|
+
e.preventDefault();
|
113
|
+
e.stopPropagation();
|
114
|
+
if ($(this).hasClass('is-active')) {
|
115
|
+
return;
|
116
|
+
}
|
117
|
+
_this._handleTabChange($(this));
|
118
|
+
});
|
119
|
+
}
|
152
120
|
|
153
121
|
/**
|
154
122
|
* Adds keyboard event handlers for items within the tabs.
|
155
123
|
* @private
|
156
124
|
*/
|
157
|
-
|
125
|
+
_addKeyHandler() {
|
158
126
|
var _this = this;
|
159
127
|
var $firstTab = _this.$element.find('li:first-of-type');
|
160
128
|
var $lastTab = _this.$element.find('li:last-of-type');
|
161
129
|
|
162
130
|
this.$tabTitles.off('keydown.zf.tabs').on('keydown.zf.tabs', function(e){
|
163
|
-
if(e.which === 9) return;
|
131
|
+
if (e.which === 9) return;
|
164
132
|
e.stopPropagation();
|
165
133
|
e.preventDefault();
|
166
134
|
|
@@ -198,8 +166,7 @@
|
|
198
166
|
}
|
199
167
|
});
|
200
168
|
});
|
201
|
-
}
|
202
|
-
|
169
|
+
}
|
203
170
|
|
204
171
|
/**
|
205
172
|
* Opens the tab `$targetContent` defined by `$target`.
|
@@ -207,15 +174,19 @@
|
|
207
174
|
* @fires Tabs#change
|
208
175
|
* @function
|
209
176
|
*/
|
210
|
-
|
177
|
+
_handleTabChange($target) {
|
211
178
|
var $tabLink = $target.find('[role="tab"]'),
|
212
179
|
hash = $tabLink[0].hash,
|
213
|
-
$targetContent =
|
214
|
-
$oldTab = this.$element.
|
215
|
-
|
216
|
-
|
180
|
+
$targetContent = this.$tabContent.find(hash),
|
181
|
+
$oldTab = this.$element.
|
182
|
+
find(`.${this.options.linkClass}.is-active`)
|
183
|
+
.removeClass('is-active')
|
184
|
+
.find('[role="tab"]')
|
185
|
+
.attr({ 'aria-selected': 'false' });
|
217
186
|
|
218
|
-
$(
|
187
|
+
$(`#${$oldTab.attr('aria-controls')}`)
|
188
|
+
.removeClass('is-active')
|
189
|
+
.attr({ 'aria-hidden': 'true' });
|
219
190
|
|
220
191
|
$target.addClass('is-active');
|
221
192
|
|
@@ -230,26 +201,27 @@
|
|
230
201
|
* @event Tabs#change
|
231
202
|
*/
|
232
203
|
this.$element.trigger('change.zf.tabs', [$target]);
|
233
|
-
|
234
|
-
};
|
204
|
+
}
|
235
205
|
|
236
206
|
/**
|
237
207
|
* Public method for selecting a content pane to display.
|
238
208
|
* @param {jQuery | String} elem - jQuery object or string of the id of the pane to display.
|
239
209
|
* @function
|
240
210
|
*/
|
241
|
-
|
211
|
+
selectTab(elem) {
|
242
212
|
var idStr;
|
243
|
-
|
213
|
+
|
214
|
+
if (typeof elem === 'object') {
|
244
215
|
idStr = elem[0].id;
|
245
|
-
}else{
|
216
|
+
} else {
|
246
217
|
idStr = elem;
|
247
218
|
}
|
248
219
|
|
249
|
-
if(idStr.indexOf('#') < 0){
|
250
|
-
idStr =
|
220
|
+
if (idStr.indexOf('#') < 0) {
|
221
|
+
idStr = `#${idStr}`;
|
251
222
|
}
|
252
|
-
|
223
|
+
|
224
|
+
var $target = this.$tabTitles.find(`[href="${idStr}"]`).parent(`.${this.options.linkClass}`);
|
253
225
|
|
254
226
|
this._handleTabChange($target);
|
255
227
|
};
|
@@ -260,46 +232,94 @@
|
|
260
232
|
* @function
|
261
233
|
* @private
|
262
234
|
*/
|
263
|
-
|
235
|
+
_setHeight() {
|
264
236
|
var max = 0;
|
265
|
-
this.$tabContent
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
237
|
+
this.$tabContent
|
238
|
+
.find(`.${this.options.panelClass}`)
|
239
|
+
.css('height', '')
|
240
|
+
.each(function() {
|
241
|
+
var panel = $(this),
|
242
|
+
isActive = panel.hasClass('is-active');
|
243
|
+
|
244
|
+
if (!isActive) {
|
245
|
+
panel.css({'visibility': 'hidden', 'display': 'block'});
|
246
|
+
}
|
247
|
+
|
248
|
+
var temp = this.getBoundingClientRect().height;
|
249
|
+
|
250
|
+
if (!isActive) {
|
251
|
+
panel.css({
|
252
|
+
'visibility': '',
|
253
|
+
'display': ''
|
254
|
+
});
|
255
|
+
}
|
256
|
+
|
257
|
+
max = temp > max ? temp : max;
|
258
|
+
})
|
259
|
+
.css('height', `${max}px`);
|
260
|
+
}
|
284
261
|
|
285
262
|
/**
|
286
263
|
* Destroys an instance of an tabs.
|
287
264
|
* @fires Tabs#destroyed
|
288
265
|
*/
|
289
|
-
|
290
|
-
this.$element
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
266
|
+
destroy() {
|
267
|
+
this.$element
|
268
|
+
.find(`.${this.options.linkClass}`)
|
269
|
+
.off('.zf.tabs').hide().end()
|
270
|
+
.find(`.${this.options.panelClass}`)
|
271
|
+
.hide();
|
272
|
+
|
273
|
+
if (this.options.matchHeight) {
|
295
274
|
$(window).off('changed.zf.mediaquery');
|
296
275
|
}
|
276
|
+
|
297
277
|
Foundation.unregisterPlugin(this);
|
298
|
-
}
|
278
|
+
}
|
279
|
+
}
|
299
280
|
|
300
|
-
|
281
|
+
Tabs.defaults = {
|
282
|
+
/**
|
283
|
+
* Allows the window to scroll to content of active pane on load if set to true.
|
284
|
+
* @option
|
285
|
+
* @example false
|
286
|
+
*/
|
287
|
+
autoFocus: false,
|
301
288
|
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
289
|
+
/**
|
290
|
+
* Allows keyboard input to 'wrap' around the tab links.
|
291
|
+
* @option
|
292
|
+
* @example true
|
293
|
+
*/
|
294
|
+
wrapOnKeys: true,
|
295
|
+
|
296
|
+
/**
|
297
|
+
* Allows the tab content panes to match heights if set to true.
|
298
|
+
* @option
|
299
|
+
* @example false
|
300
|
+
*/
|
301
|
+
matchHeight: false,
|
302
|
+
|
303
|
+
/**
|
304
|
+
* Class applied to `li`'s in tab link list.
|
305
|
+
* @option
|
306
|
+
* @example 'tabs-title'
|
307
|
+
*/
|
308
|
+
linkClass: 'tabs-title',
|
309
|
+
|
310
|
+
/**
|
311
|
+
* Class applied to the content containers.
|
312
|
+
* @option
|
313
|
+
* @example 'tabs-panel'
|
314
|
+
*/
|
315
|
+
panelClass: 'tabs-panel'
|
316
|
+
};
|
317
|
+
|
318
|
+
function checkClass($elem){
|
319
|
+
return $elem.hasClass('is-active');
|
320
|
+
}
|
321
|
+
|
322
|
+
// Window exports
|
323
|
+
Foundation.plugin(Tabs, 'Tabs');
|
324
|
+
|
325
|
+
}(jQuery);
|
@@ -1,12 +1,15 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
!function($) {
|
4
|
+
|
1
5
|
/**
|
2
6
|
* Toggler module.
|
3
7
|
* @module foundation.toggler
|
4
8
|
* @requires foundation.util.motion
|
9
|
+
* @requires foundation.util.triggers
|
5
10
|
*/
|
6
11
|
|
7
|
-
|
8
|
-
'use strict';
|
9
|
-
|
12
|
+
class Toggler {
|
10
13
|
/**
|
11
14
|
* Creates a new instance of Toggler.
|
12
15
|
* @class
|
@@ -14,7 +17,7 @@
|
|
14
17
|
* @param {Object} element - jQuery object to add the trigger to.
|
15
18
|
* @param {Object} options - Overrides to the default plugin settings.
|
16
19
|
*/
|
17
|
-
|
20
|
+
constructor(element, options) {
|
18
21
|
this.$element = element;
|
19
22
|
this.options = $.extend({}, Toggler.defaults, element.data(), options);
|
20
23
|
this.className = '';
|
@@ -25,21 +28,12 @@
|
|
25
28
|
Foundation.registerPlugin(this, 'Toggler');
|
26
29
|
}
|
27
30
|
|
28
|
-
Toggler.defaults = {
|
29
|
-
/**
|
30
|
-
* Tells the plugin if the element should animated when toggled.
|
31
|
-
* @option
|
32
|
-
* @example false
|
33
|
-
*/
|
34
|
-
animate: false
|
35
|
-
};
|
36
|
-
|
37
31
|
/**
|
38
32
|
* Initializes the Toggler plugin by parsing the toggle class from data-toggler, or animation classes from data-animate.
|
39
33
|
* @function
|
40
34
|
* @private
|
41
35
|
*/
|
42
|
-
|
36
|
+
_init() {
|
43
37
|
var input;
|
44
38
|
// Parse animation classes if they were set
|
45
39
|
if (this.options.animate) {
|
@@ -57,20 +51,20 @@
|
|
57
51
|
|
58
52
|
// Add ARIA attributes to triggers
|
59
53
|
var id = this.$element[0].id;
|
60
|
-
$(
|
54
|
+
$(`[data-open="${id}"], [data-close="${id}"], [data-toggle="${id}"]`)
|
61
55
|
.attr('aria-controls', id);
|
62
56
|
// If the target is hidden, add aria-hidden
|
63
57
|
this.$element.attr('aria-expanded', this.$element.is(':hidden') ? false : true);
|
64
|
-
}
|
58
|
+
}
|
65
59
|
|
66
60
|
/**
|
67
61
|
* Initializes events for the toggle trigger.
|
68
62
|
* @function
|
69
63
|
* @private
|
70
64
|
*/
|
71
|
-
|
65
|
+
_events() {
|
72
66
|
this.$element.off('toggle.zf.trigger').on('toggle.zf.trigger', this.toggle.bind(this));
|
73
|
-
}
|
67
|
+
}
|
74
68
|
|
75
69
|
/**
|
76
70
|
* Toggles the target class on the target element. An event is fired from the original trigger depending on if the resultant state was "on" or "off".
|
@@ -78,11 +72,11 @@
|
|
78
72
|
* @fires Toggler#on
|
79
73
|
* @fires Toggler#off
|
80
74
|
*/
|
81
|
-
|
75
|
+
toggle() {
|
82
76
|
this[ this.options.animate ? '_toggleAnimate' : '_toggleClass']();
|
83
|
-
}
|
77
|
+
}
|
84
78
|
|
85
|
-
|
79
|
+
_toggleClass() {
|
86
80
|
this.$element.toggleClass(this.className);
|
87
81
|
|
88
82
|
var isOn = this.$element.hasClass(this.className);
|
@@ -102,9 +96,9 @@
|
|
102
96
|
}
|
103
97
|
|
104
98
|
this._updateARIA(isOn);
|
105
|
-
}
|
99
|
+
}
|
106
100
|
|
107
|
-
|
101
|
+
_toggleAnimate() {
|
108
102
|
var _this = this;
|
109
103
|
|
110
104
|
if (this.$element.is(':hidden')) {
|
@@ -119,29 +113,32 @@
|
|
119
113
|
_this._updateARIA(false);
|
120
114
|
});
|
121
115
|
}
|
122
|
-
}
|
116
|
+
}
|
123
117
|
|
124
|
-
|
118
|
+
_updateARIA(isOn) {
|
125
119
|
this.$element.attr('aria-expanded', isOn ? true : false);
|
126
|
-
}
|
120
|
+
}
|
127
121
|
|
128
122
|
/**
|
129
123
|
* Destroys the instance of Toggler on the element.
|
130
124
|
* @function
|
131
125
|
*/
|
132
|
-
|
126
|
+
destroy() {
|
133
127
|
this.$element.off('.zf.toggler');
|
134
128
|
Foundation.unregisterPlugin(this);
|
135
|
-
}
|
129
|
+
}
|
130
|
+
}
|
136
131
|
|
137
|
-
|
132
|
+
Toggler.defaults = {
|
133
|
+
/**
|
134
|
+
* Tells the plugin if the element should animated when toggled.
|
135
|
+
* @option
|
136
|
+
* @example false
|
137
|
+
*/
|
138
|
+
animate: false
|
139
|
+
};
|
138
140
|
|
139
|
-
|
140
|
-
|
141
|
-
module.exports = Toggler;
|
142
|
-
if (typeof define === 'function')
|
143
|
-
define(['foundation'], function() {
|
144
|
-
return Toggler;
|
145
|
-
});
|
141
|
+
// Window exports
|
142
|
+
Foundation.plugin(Toggler, 'Toggler');
|
146
143
|
|
147
|
-
}(
|
144
|
+
}(jQuery);
|