foundation6-jekyll-base 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +2 -0
- data/_includes/footer.html +1 -0
- data/_includes/head.html +16 -0
- data/_includes/header.html +1 -0
- data/_includes/javascripts.html +4 -0
- data/_layouts/default.html +18 -0
- data/_layouts/home.html +26 -0
- data/_layouts/page.html +15 -0
- data/_layouts/post.html +25 -0
- data/_sass/_vendor/normalize-scss/sass/_normalize.scss +3 -0
- data/_sass/_vendor/normalize-scss/sass/normalize/_import-now.scss +11 -0
- data/_sass/_vendor/normalize-scss/sass/normalize/_normalize-mixin.scss +676 -0
- data/_sass/_vendor/normalize-scss/sass/normalize/_variables.scss +36 -0
- data/_sass/_vendor/normalize-scss/sass/normalize/_vertical-rhythm.scss +61 -0
- data/_sass/_vendor/sassy-lists/stylesheets/functions/_purge.scss +38 -0
- data/_sass/_vendor/sassy-lists/stylesheets/functions/_remove.scss +31 -0
- data/_sass/_vendor/sassy-lists/stylesheets/functions/_replace.scss +46 -0
- data/_sass/_vendor/sassy-lists/stylesheets/functions/_to-list.scss +27 -0
- data/_sass/_vendor/sassy-lists/stylesheets/helpers/_missing-dependencies.scss +25 -0
- data/_sass/_vendor/sassy-lists/stylesheets/helpers/_true.scss +13 -0
- data/_sass/foundation/_global.scss +219 -0
- data/_sass/foundation/components/_accordion-menu.scss +36 -0
- data/_sass/foundation/components/_accordion.scss +150 -0
- data/_sass/foundation/components/_badge.scss +63 -0
- data/_sass/foundation/components/_breadcrumbs.scss +97 -0
- data/_sass/foundation/components/_button-group.scss +249 -0
- data/_sass/foundation/components/_button.scss +303 -0
- data/_sass/foundation/components/_callout.scss +106 -0
- data/_sass/foundation/components/_card.scss +121 -0
- data/_sass/foundation/components/_close-button.scss +102 -0
- data/_sass/foundation/components/_drilldown.scss +93 -0
- data/_sass/foundation/components/_dropdown-menu.scss +226 -0
- data/_sass/foundation/components/_dropdown.scss +72 -0
- data/_sass/foundation/components/_flex-video.scss +1 -0
- data/_sass/foundation/components/_flex.scss +28 -0
- data/_sass/foundation/components/_float.scss +27 -0
- data/_sass/foundation/components/_label.scss +64 -0
- data/_sass/foundation/components/_media-object.scss +114 -0
- data/_sass/foundation/components/_menu-icon.scss +9 -0
- data/_sass/foundation/components/_menu.scss +371 -0
- data/_sass/foundation/components/_off-canvas.scss +329 -0
- data/_sass/foundation/components/_orbit.scss +196 -0
- data/_sass/foundation/components/_pagination.scss +193 -0
- data/_sass/foundation/components/_progress-bar.scss +64 -0
- data/_sass/foundation/components/_responsive-embed.scss +67 -0
- data/_sass/foundation/components/_reveal.scss +178 -0
- data/_sass/foundation/components/_slider.scss +138 -0
- data/_sass/foundation/components/_sticky.scss +38 -0
- data/_sass/foundation/components/_switch.scss +247 -0
- data/_sass/foundation/components/_table.scss +329 -0
- data/_sass/foundation/components/_tabs.scss +196 -0
- data/_sass/foundation/components/_thumbnail.scss +67 -0
- data/_sass/foundation/components/_title-bar.scss +84 -0
- data/_sass/foundation/components/_tooltip.scss +107 -0
- data/_sass/foundation/components/_top-bar.scss +173 -0
- data/_sass/foundation/components/_visibility.scss +132 -0
- data/_sass/foundation/forms/_checkbox.scss +41 -0
- data/_sass/foundation/forms/_error.scss +88 -0
- data/_sass/foundation/forms/_fieldset.scss +54 -0
- data/_sass/foundation/forms/_forms.scss +34 -0
- data/_sass/foundation/forms/_help-text.scss +30 -0
- data/_sass/foundation/forms/_input-group.scss +135 -0
- data/_sass/foundation/forms/_label.scss +50 -0
- data/_sass/foundation/forms/_meter.scss +110 -0
- data/_sass/foundation/forms/_progress.scss +94 -0
- data/_sass/foundation/forms/_range.scss +149 -0
- data/_sass/foundation/forms/_select.scss +85 -0
- data/_sass/foundation/forms/_text.scss +170 -0
- data/_sass/foundation/foundation.scss +118 -0
- data/_sass/foundation/grid/_classes.scss +176 -0
- data/_sass/foundation/grid/_column.scss +112 -0
- data/_sass/foundation/grid/_flex-grid.scss +307 -0
- data/_sass/foundation/grid/_grid.scss +44 -0
- data/_sass/foundation/grid/_gutter.scss +82 -0
- data/_sass/foundation/grid/_layout.scss +76 -0
- data/_sass/foundation/grid/_position.scss +76 -0
- data/_sass/foundation/grid/_row.scss +99 -0
- data/_sass/foundation/grid/_size.scss +24 -0
- data/_sass/foundation/settings/_settings.scss +621 -0
- data/_sass/foundation/typography/_alignment.scss +22 -0
- data/_sass/foundation/typography/_base.scss +509 -0
- data/_sass/foundation/typography/_helpers.scss +78 -0
- data/_sass/foundation/typography/_print.scss +81 -0
- data/_sass/foundation/typography/_typography.scss +26 -0
- data/_sass/foundation/util/_breakpoint.scss +281 -0
- data/_sass/foundation/util/_color.scss +126 -0
- data/_sass/foundation/util/_direction.scss +31 -0
- data/_sass/foundation/util/_flex.scss +85 -0
- data/_sass/foundation/util/_math.scss +72 -0
- data/_sass/foundation/util/_mixins.scss +276 -0
- data/_sass/foundation/util/_selector.scss +41 -0
- data/_sass/foundation/util/_unit.scss +152 -0
- data/_sass/foundation/util/_util.scss +13 -0
- data/_sass/foundation/util/_value.scss +140 -0
- data/assets/js/app.js +1 -0
- data/assets/js/vendor/foundation/foundation.d.ts +496 -0
- data/assets/js/vendor/foundation/foundation.js +10207 -0
- data/assets/js/vendor/foundation/foundation.min.js +4 -0
- data/assets/js/vendor/foundation/plugins/foundation.abide.js +637 -0
- data/assets/js/vendor/foundation/plugins/foundation.abide.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.accordion.js +252 -0
- data/assets/js/vendor/foundation/plugins/foundation.accordion.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.accordionMenu.js +318 -0
- data/assets/js/vendor/foundation/plugins/foundation.accordionMenu.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.core.js +386 -0
- data/assets/js/vendor/foundation/plugins/foundation.core.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.drilldown.js +565 -0
- data/assets/js/vendor/foundation/plugins/foundation.drilldown.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.dropdown.js +465 -0
- data/assets/js/vendor/foundation/plugins/foundation.dropdown.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.dropdownMenu.js +486 -0
- data/assets/js/vendor/foundation/plugins/foundation.dropdownMenu.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.equalizer.js +374 -0
- data/assets/js/vendor/foundation/plugins/foundation.equalizer.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.interchange.js +233 -0
- data/assets/js/vendor/foundation/plugins/foundation.interchange.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.magellan.js +285 -0
- data/assets/js/vendor/foundation/plugins/foundation.magellan.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.offcanvas.js +474 -0
- data/assets/js/vendor/foundation/plugins/foundation.offcanvas.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.orbit.js +566 -0
- data/assets/js/vendor/foundation/plugins/foundation.orbit.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.responsiveMenu.js +169 -0
- data/assets/js/vendor/foundation/plugins/foundation.responsiveMenu.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.responsiveToggle.js +177 -0
- data/assets/js/vendor/foundation/plugins/foundation.responsiveToggle.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.reveal.js +633 -0
- data/assets/js/vendor/foundation/plugins/foundation.reveal.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.slider.js +762 -0
- data/assets/js/vendor/foundation/plugins/foundation.slider.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.sticky.js +518 -0
- data/assets/js/vendor/foundation/plugins/foundation.sticky.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.tabs.js +512 -0
- data/assets/js/vendor/foundation/plugins/foundation.tabs.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.toggler.js +169 -0
- data/assets/js/vendor/foundation/plugins/foundation.toggler.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.tooltip.js +492 -0
- data/assets/js/vendor/foundation/plugins/foundation.tooltip.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.box.js +196 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.box.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.keyboard.js +163 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.keyboard.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.mediaQuery.js +233 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.mediaQuery.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.motion.js +103 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.motion.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.nest.js +74 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.nest.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.timerAndImageLoader.js +90 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.timerAndImageLoader.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.touch.js +352 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.touch.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.triggers.js +261 -0
- data/assets/js/vendor/foundation/plugins/foundation.util.triggers.min.js +1 -0
- data/assets/js/vendor/foundation/plugins/foundation.zf.responsiveAccordionTabs.js +262 -0
- data/assets/js/vendor/foundation/plugins/foundation.zf.responsiveAccordionTabs.min.js +1 -0
- data/assets/main.scss +6 -0
- metadata +232 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function _classCallCheck(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,n){for(var t=0;t<n.length;t++){var i=n[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(n,t,i){return t&&e(n.prototype,t),i&&e(n,i),n}}();!function(e){var n=function(){function n(t,i){_classCallCheck(this,n),this.$element=t,this.options=e.extend({},n.defaults,i),this.rules=[],this.currentPath="",this._init(),this._events(),Foundation.registerPlugin(this,"Interchange")}return _createClass(n,[{key:"_init",value:function(){this._addBreakpoints(),this._generateRules(),this._reflow()}},{key:"_events",value:function(){var n=this;e(window).on("resize.zf.interchange",Foundation.util.throttle(function(){n._reflow()},50))}},{key:"_reflow",value:function(){var e;for(var n in this.rules)if(this.rules.hasOwnProperty(n)){var t=this.rules[n];window.matchMedia(t.query).matches&&(e=t)}e&&this.replace(e.path)}},{key:"_addBreakpoints",value:function(){for(var e in Foundation.MediaQuery.queries)if(Foundation.MediaQuery.queries.hasOwnProperty(e)){var t=Foundation.MediaQuery.queries[e];n.SPECIAL_QUERIES[t.name]=t.value}}},{key:"_generateRules",value:function(e){var t,i=[];t=this.options.rules?this.options.rules:this.$element.data("interchange"),t="string"==typeof t?t.match(/\[.*?\]/g):t;for(var r in t)if(t.hasOwnProperty(r)){var a=t[r].slice(1,-1).split(", "),o=a.slice(0,-1).join(""),s=a[a.length-1];n.SPECIAL_QUERIES[s]&&(s=n.SPECIAL_QUERIES[s]),i.push({path:o,query:s})}this.rules=i}},{key:"replace",value:function(n){if(this.currentPath!==n){var t=this,i="replaced.zf.interchange";"IMG"===this.$element[0].nodeName?this.$element.attr("src",n).on("load",function(){t.currentPath=n}).trigger(i):n.match(/\.(gif|jpg|jpeg|png|svg|tiff)([?#].*)?/i)?this.$element.css({"background-image":"url("+n+")"}).trigger(i):e.get(n,function(r){t.$element.html(r).trigger(i),e(r).foundation(),t.currentPath=n})}}},{key:"destroy",value:function(){}}]),n}();n.defaults={rules:null},n.SPECIAL_QUERIES={landscape:"screen and (orientation: landscape)",portrait:"screen and (orientation: portrait)",retina:"only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx)"},Foundation.plugin(n,"Interchange")}(jQuery);
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
4
|
+
|
|
5
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
|
+
|
|
7
|
+
!function ($) {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Magellan module.
|
|
11
|
+
* @module foundation.magellan
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
var Magellan = function () {
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new instance of Magellan.
|
|
17
|
+
* @class
|
|
18
|
+
* @fires Magellan#init
|
|
19
|
+
* @param {Object} element - jQuery object to add the trigger to.
|
|
20
|
+
* @param {Object} options - Overrides to the default plugin settings.
|
|
21
|
+
*/
|
|
22
|
+
function Magellan(element, options) {
|
|
23
|
+
_classCallCheck(this, Magellan);
|
|
24
|
+
|
|
25
|
+
this.$element = element;
|
|
26
|
+
this.options = $.extend({}, Magellan.defaults, this.$element.data(), options);
|
|
27
|
+
|
|
28
|
+
this._init();
|
|
29
|
+
this.calcPoints();
|
|
30
|
+
|
|
31
|
+
Foundation.registerPlugin(this, 'Magellan');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Initializes the Magellan plugin and calls functions to get equalizer functioning on load.
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
_createClass(Magellan, [{
|
|
41
|
+
key: '_init',
|
|
42
|
+
value: function _init() {
|
|
43
|
+
var id = this.$element[0].id || Foundation.GetYoDigits(6, 'magellan');
|
|
44
|
+
var _this = this;
|
|
45
|
+
this.$targets = $('[data-magellan-target]');
|
|
46
|
+
this.$links = this.$element.find('a');
|
|
47
|
+
this.$element.attr({
|
|
48
|
+
'data-resize': id,
|
|
49
|
+
'data-scroll': id,
|
|
50
|
+
'id': id
|
|
51
|
+
});
|
|
52
|
+
this.$active = $();
|
|
53
|
+
this.scrollPos = parseInt(window.pageYOffset, 10);
|
|
54
|
+
|
|
55
|
+
this._events();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Calculates an array of pixel values that are the demarcation lines between locations on the page.
|
|
60
|
+
* Can be invoked if new elements are added or the size of a location changes.
|
|
61
|
+
* @function
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
}, {
|
|
65
|
+
key: 'calcPoints',
|
|
66
|
+
value: function calcPoints() {
|
|
67
|
+
var _this = this,
|
|
68
|
+
body = document.body,
|
|
69
|
+
html = document.documentElement;
|
|
70
|
+
|
|
71
|
+
this.points = [];
|
|
72
|
+
this.winHeight = Math.round(Math.max(window.innerHeight, html.clientHeight));
|
|
73
|
+
this.docHeight = Math.round(Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight));
|
|
74
|
+
|
|
75
|
+
this.$targets.each(function () {
|
|
76
|
+
var $tar = $(this),
|
|
77
|
+
pt = Math.round($tar.offset().top - _this.options.threshold);
|
|
78
|
+
$tar.targetPoint = pt;
|
|
79
|
+
_this.points.push(pt);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Initializes events for Magellan.
|
|
85
|
+
* @private
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
}, {
|
|
89
|
+
key: '_events',
|
|
90
|
+
value: function _events() {
|
|
91
|
+
var _this = this,
|
|
92
|
+
$body = $('html, body'),
|
|
93
|
+
opts = {
|
|
94
|
+
duration: _this.options.animationDuration,
|
|
95
|
+
easing: _this.options.animationEasing
|
|
96
|
+
};
|
|
97
|
+
$(window).one('load', function () {
|
|
98
|
+
if (_this.options.deepLinking) {
|
|
99
|
+
if (location.hash) {
|
|
100
|
+
_this.scrollToLoc(location.hash);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
_this.calcPoints();
|
|
104
|
+
_this._updateActive();
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
this.$element.on({
|
|
108
|
+
'resizeme.zf.trigger': this.reflow.bind(this),
|
|
109
|
+
'scrollme.zf.trigger': this._updateActive.bind(this)
|
|
110
|
+
}).on('click.zf.magellan', 'a[href^="#"]', function (e) {
|
|
111
|
+
e.preventDefault();
|
|
112
|
+
var arrival = this.getAttribute('href');
|
|
113
|
+
_this.scrollToLoc(arrival);
|
|
114
|
+
});
|
|
115
|
+
$(window).on('popstate', function (e) {
|
|
116
|
+
if (_this.options.deepLinking) {
|
|
117
|
+
_this.scrollToLoc(window.location.hash);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Function to scroll to a given location on the page.
|
|
124
|
+
* @param {String} loc - a properly formatted jQuery id selector. Example: '#foo'
|
|
125
|
+
* @function
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
}, {
|
|
129
|
+
key: 'scrollToLoc',
|
|
130
|
+
value: function scrollToLoc(loc) {
|
|
131
|
+
// Do nothing if target does not exist to prevent errors
|
|
132
|
+
if (!$(loc).length) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
this._inTransition = true;
|
|
136
|
+
var _this = this,
|
|
137
|
+
scrollPos = Math.round($(loc).offset().top - this.options.threshold / 2 - this.options.barOffset);
|
|
138
|
+
|
|
139
|
+
$('html, body').stop(true).animate({ scrollTop: scrollPos }, this.options.animationDuration, this.options.animationEasing, function () {
|
|
140
|
+
_this._inTransition = false;_this._updateActive();
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Calls necessary functions to update Magellan upon DOM change
|
|
146
|
+
* @function
|
|
147
|
+
*/
|
|
148
|
+
|
|
149
|
+
}, {
|
|
150
|
+
key: 'reflow',
|
|
151
|
+
value: function reflow() {
|
|
152
|
+
this.calcPoints();
|
|
153
|
+
this._updateActive();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Updates the visibility of an active location link, and updates the url hash for the page, if deepLinking enabled.
|
|
158
|
+
* @private
|
|
159
|
+
* @function
|
|
160
|
+
* @fires Magellan#update
|
|
161
|
+
*/
|
|
162
|
+
|
|
163
|
+
}, {
|
|
164
|
+
key: '_updateActive',
|
|
165
|
+
value: function _updateActive() /*evt, elem, scrollPos*/{
|
|
166
|
+
if (this._inTransition) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
var winPos = /*scrollPos ||*/parseInt(window.pageYOffset, 10),
|
|
170
|
+
curIdx;
|
|
171
|
+
|
|
172
|
+
if (winPos + this.winHeight === this.docHeight) {
|
|
173
|
+
curIdx = this.points.length - 1;
|
|
174
|
+
} else if (winPos < this.points[0]) {
|
|
175
|
+
curIdx = undefined;
|
|
176
|
+
} else {
|
|
177
|
+
var isDown = this.scrollPos < winPos,
|
|
178
|
+
_this = this,
|
|
179
|
+
curVisible = this.points.filter(function (p, i) {
|
|
180
|
+
return isDown ? p - _this.options.barOffset <= winPos : p - _this.options.barOffset - _this.options.threshold <= winPos;
|
|
181
|
+
});
|
|
182
|
+
curIdx = curVisible.length ? curVisible.length - 1 : 0;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
this.$active.removeClass(this.options.activeClass);
|
|
186
|
+
this.$active = this.$links.filter('[href="#' + this.$targets.eq(curIdx).data('magellan-target') + '"]').addClass(this.options.activeClass);
|
|
187
|
+
|
|
188
|
+
if (this.options.deepLinking) {
|
|
189
|
+
var hash = "";
|
|
190
|
+
if (curIdx != undefined) {
|
|
191
|
+
hash = this.$active[0].getAttribute('href');
|
|
192
|
+
}
|
|
193
|
+
if (hash !== window.location.hash) {
|
|
194
|
+
if (window.history.pushState) {
|
|
195
|
+
window.history.pushState(null, null, hash);
|
|
196
|
+
} else {
|
|
197
|
+
window.location.hash = hash;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
this.scrollPos = winPos;
|
|
203
|
+
/**
|
|
204
|
+
* Fires when magellan is finished updating to the new active element.
|
|
205
|
+
* @event Magellan#update
|
|
206
|
+
*/
|
|
207
|
+
this.$element.trigger('update.zf.magellan', [this.$active]);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Destroys an instance of Magellan and resets the url of the window.
|
|
212
|
+
* @function
|
|
213
|
+
*/
|
|
214
|
+
|
|
215
|
+
}, {
|
|
216
|
+
key: 'destroy',
|
|
217
|
+
value: function destroy() {
|
|
218
|
+
this.$element.off('.zf.trigger .zf.magellan').find('.' + this.options.activeClass).removeClass(this.options.activeClass);
|
|
219
|
+
|
|
220
|
+
if (this.options.deepLinking) {
|
|
221
|
+
var hash = this.$active[0].getAttribute('href');
|
|
222
|
+
window.location.hash.replace(hash, '');
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
Foundation.unregisterPlugin(this);
|
|
226
|
+
}
|
|
227
|
+
}]);
|
|
228
|
+
|
|
229
|
+
return Magellan;
|
|
230
|
+
}();
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Default settings for plugin
|
|
234
|
+
*/
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
Magellan.defaults = {
|
|
238
|
+
/**
|
|
239
|
+
* Amount of time, in ms, the animated scrolling should take between locations.
|
|
240
|
+
* @option
|
|
241
|
+
* @type {number}
|
|
242
|
+
* @default 500
|
|
243
|
+
*/
|
|
244
|
+
animationDuration: 500,
|
|
245
|
+
/**
|
|
246
|
+
* Animation style to use when scrolling between locations. Can be `'swing'` or `'linear'`.
|
|
247
|
+
* @option
|
|
248
|
+
* @type {string}
|
|
249
|
+
* @default 'linear'
|
|
250
|
+
* @see {@link https://api.jquery.com/animate|Jquery animate}
|
|
251
|
+
*/
|
|
252
|
+
animationEasing: 'linear',
|
|
253
|
+
/**
|
|
254
|
+
* Number of pixels to use as a marker for location changes.
|
|
255
|
+
* @option
|
|
256
|
+
* @type {number}
|
|
257
|
+
* @default 50
|
|
258
|
+
*/
|
|
259
|
+
threshold: 50,
|
|
260
|
+
/**
|
|
261
|
+
* Class applied to the active locations link on the magellan container.
|
|
262
|
+
* @option
|
|
263
|
+
* @type {string}
|
|
264
|
+
* @default 'active'
|
|
265
|
+
*/
|
|
266
|
+
activeClass: 'active',
|
|
267
|
+
/**
|
|
268
|
+
* Allows the script to manipulate the url of the current page, and if supported, alter the history.
|
|
269
|
+
* @option
|
|
270
|
+
* @type {boolean}
|
|
271
|
+
* @default false
|
|
272
|
+
*/
|
|
273
|
+
deepLinking: false,
|
|
274
|
+
/**
|
|
275
|
+
* Number of pixels to offset the scroll of the page on item click if using a sticky nav bar.
|
|
276
|
+
* @option
|
|
277
|
+
* @type {number}
|
|
278
|
+
* @default 0
|
|
279
|
+
*/
|
|
280
|
+
barOffset: 0
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
// Window exports
|
|
284
|
+
Foundation.plugin(Magellan, 'Magellan');
|
|
285
|
+
}(jQuery);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function _classCallCheck(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function t(t,i){for(var e=0;e<i.length;e++){var n=i[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(i,e,n){return e&&t(i.prototype,e),n&&t(i,n),i}}();!function(t){var i=function(){function i(e,n){_classCallCheck(this,i),this.$element=e,this.options=t.extend({},i.defaults,this.$element.data(),n),this._init(),this.calcPoints(),Foundation.registerPlugin(this,"Magellan")}return _createClass(i,[{key:"_init",value:function(){var i=this.$element[0].id||Foundation.GetYoDigits(6,"magellan");this.$targets=t("[data-magellan-target]"),this.$links=this.$element.find("a"),this.$element.attr({"data-resize":i,"data-scroll":i,id:i}),this.$active=t(),this.scrollPos=parseInt(window.pageYOffset,10),this._events()}},{key:"calcPoints",value:function(){var i=this,e=document.body,n=document.documentElement;this.points=[],this.winHeight=Math.round(Math.max(window.innerHeight,n.clientHeight)),this.docHeight=Math.round(Math.max(e.scrollHeight,e.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight)),this.$targets.each(function(){var e=t(this),n=Math.round(e.offset().top-i.options.threshold);e.targetPoint=n,i.points.push(n)})}},{key:"_events",value:function(){var i=this;t("html, body"),{duration:i.options.animationDuration,easing:i.options.animationEasing};t(window).one("load",function(){i.options.deepLinking&&location.hash&&i.scrollToLoc(location.hash),i.calcPoints(),i._updateActive()}),this.$element.on({"resizeme.zf.trigger":this.reflow.bind(this),"scrollme.zf.trigger":this._updateActive.bind(this)}).on("click.zf.magellan",'a[href^="#"]',function(t){t.preventDefault();var e=this.getAttribute("href");i.scrollToLoc(e)}),t(window).on("popstate",function(t){i.options.deepLinking&&i.scrollToLoc(window.location.hash)})}},{key:"scrollToLoc",value:function(i){if(!t(i).length)return!1;this._inTransition=!0;var e=this,n=Math.round(t(i).offset().top-this.options.threshold/2-this.options.barOffset);t("html, body").stop(!0).animate({scrollTop:n},this.options.animationDuration,this.options.animationEasing,function(){e._inTransition=!1,e._updateActive()})}},{key:"reflow",value:function(){this.calcPoints(),this._updateActive()}},{key:"_updateActive",value:function(){if(!this._inTransition){var t,i=parseInt(window.pageYOffset,10);if(i+this.winHeight===this.docHeight)t=this.points.length-1;else if(i<this.points[0])t=void 0;else{var e=this.scrollPos<i,n=this,s=this.points.filter(function(t,s){return e?t-n.options.barOffset<=i:t-n.options.barOffset-n.options.threshold<=i});t=s.length?s.length-1:0}if(this.$active.removeClass(this.options.activeClass),this.$active=this.$links.filter('[href="#'+this.$targets.eq(t).data("magellan-target")+'"]').addClass(this.options.activeClass),this.options.deepLinking){var o="";void 0!=t&&(o=this.$active[0].getAttribute("href")),o!==window.location.hash&&(window.history.pushState?window.history.pushState(null,null,o):window.location.hash=o)}this.scrollPos=i,this.$element.trigger("update.zf.magellan",[this.$active])}}},{key:"destroy",value:function(){if(this.$element.off(".zf.trigger .zf.magellan").find("."+this.options.activeClass).removeClass(this.options.activeClass),this.options.deepLinking){var t=this.$active[0].getAttribute("href");window.location.hash.replace(t,"")}Foundation.unregisterPlugin(this)}}]),i}();i.defaults={animationDuration:500,animationEasing:"linear",threshold:50,activeClass:"active",deepLinking:!1,barOffset:0},Foundation.plugin(i,"Magellan")}(jQuery);
|
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
4
|
+
|
|
5
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
|
+
|
|
7
|
+
!function ($) {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* OffCanvas module.
|
|
11
|
+
* @module foundation.offcanvas
|
|
12
|
+
* @requires foundation.util.keyboard
|
|
13
|
+
* @requires foundation.util.mediaQuery
|
|
14
|
+
* @requires foundation.util.triggers
|
|
15
|
+
* @requires foundation.util.motion
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
var OffCanvas = function () {
|
|
19
|
+
/**
|
|
20
|
+
* Creates a new instance of an off-canvas wrapper.
|
|
21
|
+
* @class
|
|
22
|
+
* @fires OffCanvas#init
|
|
23
|
+
* @param {Object} element - jQuery object to initialize.
|
|
24
|
+
* @param {Object} options - Overrides to the default plugin settings.
|
|
25
|
+
*/
|
|
26
|
+
function OffCanvas(element, options) {
|
|
27
|
+
_classCallCheck(this, OffCanvas);
|
|
28
|
+
|
|
29
|
+
this.$element = element;
|
|
30
|
+
this.options = $.extend({}, OffCanvas.defaults, this.$element.data(), options);
|
|
31
|
+
this.$lastTrigger = $();
|
|
32
|
+
this.$triggers = $();
|
|
33
|
+
|
|
34
|
+
this._init();
|
|
35
|
+
this._events();
|
|
36
|
+
|
|
37
|
+
Foundation.registerPlugin(this, 'OffCanvas');
|
|
38
|
+
Foundation.Keyboard.register('OffCanvas', {
|
|
39
|
+
'ESCAPE': 'close'
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Initializes the off-canvas wrapper by adding the exit overlay (if needed).
|
|
45
|
+
* @function
|
|
46
|
+
* @private
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
_createClass(OffCanvas, [{
|
|
51
|
+
key: '_init',
|
|
52
|
+
value: function _init() {
|
|
53
|
+
var id = this.$element.attr('id');
|
|
54
|
+
|
|
55
|
+
this.$element.attr('aria-hidden', 'true');
|
|
56
|
+
|
|
57
|
+
this.$element.addClass('is-transition-' + this.options.transition);
|
|
58
|
+
|
|
59
|
+
// Find triggers that affect this element and add aria-expanded to them
|
|
60
|
+
this.$triggers = $(document).find('[data-open="' + id + '"], [data-close="' + id + '"], [data-toggle="' + id + '"]').attr('aria-expanded', 'false').attr('aria-controls', id);
|
|
61
|
+
|
|
62
|
+
// Add an overlay over the content if necessary
|
|
63
|
+
if (this.options.contentOverlay === true) {
|
|
64
|
+
var overlay = document.createElement('div');
|
|
65
|
+
var overlayPosition = $(this.$element).css("position") === 'fixed' ? 'is-overlay-fixed' : 'is-overlay-absolute';
|
|
66
|
+
overlay.setAttribute('class', 'js-off-canvas-overlay ' + overlayPosition);
|
|
67
|
+
this.$overlay = $(overlay);
|
|
68
|
+
if (overlayPosition === 'is-overlay-fixed') {
|
|
69
|
+
$('body').append(this.$overlay);
|
|
70
|
+
} else {
|
|
71
|
+
this.$element.siblings('[data-off-canvas-content]').append(this.$overlay);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
this.options.isRevealed = this.options.isRevealed || new RegExp(this.options.revealClass, 'g').test(this.$element[0].className);
|
|
76
|
+
|
|
77
|
+
if (this.options.isRevealed === true) {
|
|
78
|
+
this.options.revealOn = this.options.revealOn || this.$element[0].className.match(/(reveal-for-medium|reveal-for-large)/g)[0].split('-')[2];
|
|
79
|
+
this._setMQChecker();
|
|
80
|
+
}
|
|
81
|
+
if (!this.options.transitionTime === true) {
|
|
82
|
+
this.options.transitionTime = parseFloat(window.getComputedStyle($('[data-off-canvas]')[0]).transitionDuration) * 1000;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Adds event handlers to the off-canvas wrapper and the exit overlay.
|
|
88
|
+
* @function
|
|
89
|
+
* @private
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
}, {
|
|
93
|
+
key: '_events',
|
|
94
|
+
value: function _events() {
|
|
95
|
+
this.$element.off('.zf.trigger .zf.offcanvas').on({
|
|
96
|
+
'open.zf.trigger': this.open.bind(this),
|
|
97
|
+
'close.zf.trigger': this.close.bind(this),
|
|
98
|
+
'toggle.zf.trigger': this.toggle.bind(this),
|
|
99
|
+
'keydown.zf.offcanvas': this._handleKeyboard.bind(this)
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
if (this.options.closeOnClick === true) {
|
|
103
|
+
var $target = this.options.contentOverlay ? this.$overlay : $('[data-off-canvas-content]');
|
|
104
|
+
$target.on({ 'click.zf.offcanvas': this.close.bind(this) });
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Applies event listener for elements that will reveal at certain breakpoints.
|
|
110
|
+
* @private
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
}, {
|
|
114
|
+
key: '_setMQChecker',
|
|
115
|
+
value: function _setMQChecker() {
|
|
116
|
+
var _this = this;
|
|
117
|
+
|
|
118
|
+
$(window).on('changed.zf.mediaquery', function () {
|
|
119
|
+
if (Foundation.MediaQuery.atLeast(_this.options.revealOn)) {
|
|
120
|
+
_this.reveal(true);
|
|
121
|
+
} else {
|
|
122
|
+
_this.reveal(false);
|
|
123
|
+
}
|
|
124
|
+
}).one('load.zf.offcanvas', function () {
|
|
125
|
+
if (Foundation.MediaQuery.atLeast(_this.options.revealOn)) {
|
|
126
|
+
_this.reveal(true);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Handles the revealing/hiding the off-canvas at breakpoints, not the same as open.
|
|
133
|
+
* @param {Boolean} isRevealed - true if element should be revealed.
|
|
134
|
+
* @function
|
|
135
|
+
*/
|
|
136
|
+
|
|
137
|
+
}, {
|
|
138
|
+
key: 'reveal',
|
|
139
|
+
value: function reveal(isRevealed) {
|
|
140
|
+
var $closer = this.$element.find('[data-close]');
|
|
141
|
+
if (isRevealed) {
|
|
142
|
+
this.close();
|
|
143
|
+
this.isRevealed = true;
|
|
144
|
+
this.$element.attr('aria-hidden', 'false');
|
|
145
|
+
this.$element.off('open.zf.trigger toggle.zf.trigger');
|
|
146
|
+
if ($closer.length) {
|
|
147
|
+
$closer.hide();
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
this.isRevealed = false;
|
|
151
|
+
this.$element.attr('aria-hidden', 'true');
|
|
152
|
+
this.$element.on({
|
|
153
|
+
'open.zf.trigger': this.open.bind(this),
|
|
154
|
+
'toggle.zf.trigger': this.toggle.bind(this)
|
|
155
|
+
});
|
|
156
|
+
if ($closer.length) {
|
|
157
|
+
$closer.show();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Stops scrolling of the body when offcanvas is open on mobile Safari and other troublesome browsers.
|
|
164
|
+
* @private
|
|
165
|
+
*/
|
|
166
|
+
|
|
167
|
+
}, {
|
|
168
|
+
key: '_stopScrolling',
|
|
169
|
+
value: function _stopScrolling(event) {
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Taken and adapted from http://stackoverflow.com/questions/16889447/prevent-full-page-scrolling-ios
|
|
174
|
+
// Only really works for y, not sure how to extend to x or if we need to.
|
|
175
|
+
|
|
176
|
+
}, {
|
|
177
|
+
key: '_recordScrollable',
|
|
178
|
+
value: function _recordScrollable(event) {
|
|
179
|
+
var elem = this; // called from event handler context with this as elem
|
|
180
|
+
|
|
181
|
+
// If the element is scrollable (content overflows), then...
|
|
182
|
+
if (elem.scrollHeight !== elem.clientHeight) {
|
|
183
|
+
// If we're at the top, scroll down one pixel to allow scrolling up
|
|
184
|
+
if (elem.scrollTop === 0) {
|
|
185
|
+
elem.scrollTop = 1;
|
|
186
|
+
}
|
|
187
|
+
// If we're at the bottom, scroll up one pixel to allow scrolling down
|
|
188
|
+
if (elem.scrollTop === elem.scrollHeight - elem.clientHeight) {
|
|
189
|
+
elem.scrollTop = elem.scrollHeight - elem.clientHeight - 1;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
elem.allowUp = elem.scrollTop > 0;
|
|
193
|
+
elem.allowDown = elem.scrollTop < elem.scrollHeight - elem.clientHeight;
|
|
194
|
+
elem.lastY = event.originalEvent.pageY;
|
|
195
|
+
}
|
|
196
|
+
}, {
|
|
197
|
+
key: '_stopScrollPropagation',
|
|
198
|
+
value: function _stopScrollPropagation(event) {
|
|
199
|
+
var elem = this; // called from event handler context with this as elem
|
|
200
|
+
var up = event.pageY < elem.lastY;
|
|
201
|
+
var down = !up;
|
|
202
|
+
elem.lastY = event.pageY;
|
|
203
|
+
|
|
204
|
+
if (up && elem.allowUp || down && elem.allowDown) {
|
|
205
|
+
event.stopPropagation();
|
|
206
|
+
} else {
|
|
207
|
+
event.preventDefault();
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Opens the off-canvas menu.
|
|
213
|
+
* @function
|
|
214
|
+
* @param {Object} event - Event object passed from listener.
|
|
215
|
+
* @param {jQuery} trigger - element that triggered the off-canvas to open.
|
|
216
|
+
* @fires OffCanvas#opened
|
|
217
|
+
*/
|
|
218
|
+
|
|
219
|
+
}, {
|
|
220
|
+
key: 'open',
|
|
221
|
+
value: function open(event, trigger) {
|
|
222
|
+
if (this.$element.hasClass('is-open') || this.isRevealed) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
var _this = this;
|
|
226
|
+
|
|
227
|
+
if (trigger) {
|
|
228
|
+
this.$lastTrigger = trigger;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (this.options.forceTo === 'top') {
|
|
232
|
+
window.scrollTo(0, 0);
|
|
233
|
+
} else if (this.options.forceTo === 'bottom') {
|
|
234
|
+
window.scrollTo(0, document.body.scrollHeight);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Fires when the off-canvas menu opens.
|
|
239
|
+
* @event OffCanvas#opened
|
|
240
|
+
*/
|
|
241
|
+
_this.$element.addClass('is-open');
|
|
242
|
+
|
|
243
|
+
this.$triggers.attr('aria-expanded', 'true');
|
|
244
|
+
this.$element.attr('aria-hidden', 'false').trigger('opened.zf.offcanvas');
|
|
245
|
+
|
|
246
|
+
// If `contentScroll` is set to false, add class and disable scrolling on touch devices.
|
|
247
|
+
if (this.options.contentScroll === false) {
|
|
248
|
+
$('body').addClass('is-off-canvas-open').on('touchmove', this._stopScrolling);
|
|
249
|
+
this.$element.on('touchstart', this._recordScrollable);
|
|
250
|
+
this.$element.on('touchmove', this._stopScrollPropagation);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (this.options.contentOverlay === true) {
|
|
254
|
+
this.$overlay.addClass('is-visible');
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (this.options.closeOnClick === true && this.options.contentOverlay === true) {
|
|
258
|
+
this.$overlay.addClass('is-closable');
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
if (this.options.autoFocus === true) {
|
|
262
|
+
this.$element.one(Foundation.transitionend(this.$element), function () {
|
|
263
|
+
_this.$element.find('a, button').eq(0).focus();
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
if (this.options.trapFocus === true) {
|
|
268
|
+
this.$element.siblings('[data-off-canvas-content]').attr('tabindex', '-1');
|
|
269
|
+
Foundation.Keyboard.trapFocus(this.$element);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Closes the off-canvas menu.
|
|
275
|
+
* @function
|
|
276
|
+
* @param {Function} cb - optional cb to fire after closure.
|
|
277
|
+
* @fires OffCanvas#closed
|
|
278
|
+
*/
|
|
279
|
+
|
|
280
|
+
}, {
|
|
281
|
+
key: 'close',
|
|
282
|
+
value: function close(cb) {
|
|
283
|
+
if (!this.$element.hasClass('is-open') || this.isRevealed) {
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
var _this = this;
|
|
288
|
+
|
|
289
|
+
_this.$element.removeClass('is-open');
|
|
290
|
+
|
|
291
|
+
this.$element.attr('aria-hidden', 'true')
|
|
292
|
+
/**
|
|
293
|
+
* Fires when the off-canvas menu opens.
|
|
294
|
+
* @event OffCanvas#closed
|
|
295
|
+
*/
|
|
296
|
+
.trigger('closed.zf.offcanvas');
|
|
297
|
+
|
|
298
|
+
// If `contentScroll` is set to false, remove class and re-enable scrolling on touch devices.
|
|
299
|
+
if (this.options.contentScroll === false) {
|
|
300
|
+
$('body').removeClass('is-off-canvas-open').off('touchmove', this._stopScrolling);
|
|
301
|
+
this.$element.off('touchstart', this._recordScrollable);
|
|
302
|
+
this.$element.off('touchmove', this._stopScrollPropagation);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
if (this.options.contentOverlay === true) {
|
|
306
|
+
this.$overlay.removeClass('is-visible');
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
if (this.options.closeOnClick === true && this.options.contentOverlay === true) {
|
|
310
|
+
this.$overlay.removeClass('is-closable');
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
this.$triggers.attr('aria-expanded', 'false');
|
|
314
|
+
|
|
315
|
+
if (this.options.trapFocus === true) {
|
|
316
|
+
this.$element.siblings('[data-off-canvas-content]').removeAttr('tabindex');
|
|
317
|
+
Foundation.Keyboard.releaseFocus(this.$element);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Toggles the off-canvas menu open or closed.
|
|
323
|
+
* @function
|
|
324
|
+
* @param {Object} event - Event object passed from listener.
|
|
325
|
+
* @param {jQuery} trigger - element that triggered the off-canvas to open.
|
|
326
|
+
*/
|
|
327
|
+
|
|
328
|
+
}, {
|
|
329
|
+
key: 'toggle',
|
|
330
|
+
value: function toggle(event, trigger) {
|
|
331
|
+
if (this.$element.hasClass('is-open')) {
|
|
332
|
+
this.close(event, trigger);
|
|
333
|
+
} else {
|
|
334
|
+
this.open(event, trigger);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Handles keyboard input when detected. When the escape key is pressed, the off-canvas menu closes, and focus is restored to the element that opened the menu.
|
|
340
|
+
* @function
|
|
341
|
+
* @private
|
|
342
|
+
*/
|
|
343
|
+
|
|
344
|
+
}, {
|
|
345
|
+
key: '_handleKeyboard',
|
|
346
|
+
value: function _handleKeyboard(e) {
|
|
347
|
+
var _this2 = this;
|
|
348
|
+
|
|
349
|
+
Foundation.Keyboard.handleKey(e, 'OffCanvas', {
|
|
350
|
+
close: function () {
|
|
351
|
+
_this2.close();
|
|
352
|
+
_this2.$lastTrigger.focus();
|
|
353
|
+
return true;
|
|
354
|
+
},
|
|
355
|
+
handled: function () {
|
|
356
|
+
e.stopPropagation();
|
|
357
|
+
e.preventDefault();
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Destroys the offcanvas plugin.
|
|
364
|
+
* @function
|
|
365
|
+
*/
|
|
366
|
+
|
|
367
|
+
}, {
|
|
368
|
+
key: 'destroy',
|
|
369
|
+
value: function destroy() {
|
|
370
|
+
this.close();
|
|
371
|
+
this.$element.off('.zf.trigger .zf.offcanvas');
|
|
372
|
+
this.$overlay.off('.zf.offcanvas');
|
|
373
|
+
|
|
374
|
+
Foundation.unregisterPlugin(this);
|
|
375
|
+
}
|
|
376
|
+
}]);
|
|
377
|
+
|
|
378
|
+
return OffCanvas;
|
|
379
|
+
}();
|
|
380
|
+
|
|
381
|
+
OffCanvas.defaults = {
|
|
382
|
+
/**
|
|
383
|
+
* Allow the user to click outside of the menu to close it.
|
|
384
|
+
* @option
|
|
385
|
+
* @type {boolean}
|
|
386
|
+
* @default true
|
|
387
|
+
*/
|
|
388
|
+
closeOnClick: true,
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Adds an overlay on top of `[data-off-canvas-content]`.
|
|
392
|
+
* @option
|
|
393
|
+
* @type {boolean}
|
|
394
|
+
* @default true
|
|
395
|
+
*/
|
|
396
|
+
contentOverlay: true,
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Enable/disable scrolling of the main content when an off canvas panel is open.
|
|
400
|
+
* @option
|
|
401
|
+
* @type {boolean}
|
|
402
|
+
* @default true
|
|
403
|
+
*/
|
|
404
|
+
contentScroll: true,
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Amount of time in ms the open and close transition requires. If none selected, pulls from body style.
|
|
408
|
+
* @option
|
|
409
|
+
* @type {number}
|
|
410
|
+
* @default 0
|
|
411
|
+
*/
|
|
412
|
+
transitionTime: 0,
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Type of transition for the offcanvas menu. Options are 'push', 'detached' or 'slide'.
|
|
416
|
+
* @option
|
|
417
|
+
* @type {string}
|
|
418
|
+
* @default push
|
|
419
|
+
*/
|
|
420
|
+
transition: 'push',
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Force the page to scroll to top or bottom on open.
|
|
424
|
+
* @option
|
|
425
|
+
* @type {?string}
|
|
426
|
+
* @default null
|
|
427
|
+
*/
|
|
428
|
+
forceTo: null,
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Allow the offcanvas to remain open for certain breakpoints.
|
|
432
|
+
* @option
|
|
433
|
+
* @type {boolean}
|
|
434
|
+
* @default false
|
|
435
|
+
*/
|
|
436
|
+
isRevealed: false,
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* Breakpoint at which to reveal. JS will use a RegExp to target standard classes, if changing classnames, pass your class with the `revealClass` option.
|
|
440
|
+
* @option
|
|
441
|
+
* @type {?string}
|
|
442
|
+
* @default null
|
|
443
|
+
*/
|
|
444
|
+
revealOn: null,
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* Force focus to the offcanvas on open. If true, will focus the opening trigger on close.
|
|
448
|
+
* @option
|
|
449
|
+
* @type {boolean}
|
|
450
|
+
* @default true
|
|
451
|
+
*/
|
|
452
|
+
autoFocus: true,
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* Class used to force an offcanvas to remain open. Foundation defaults for this are `reveal-for-large` & `reveal-for-medium`.
|
|
456
|
+
* @option
|
|
457
|
+
* @type {string}
|
|
458
|
+
* @default reveal-for-
|
|
459
|
+
* @todo improve the regex testing for this.
|
|
460
|
+
*/
|
|
461
|
+
revealClass: 'reveal-for-',
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Triggers optional focus trapping when opening an offcanvas. Sets tabindex of [data-off-canvas-content] to -1 for accessibility purposes.
|
|
465
|
+
* @option
|
|
466
|
+
* @type {boolean}
|
|
467
|
+
* @default false
|
|
468
|
+
*/
|
|
469
|
+
trapFocus: false
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
// Window exports
|
|
473
|
+
Foundation.plugin(OffCanvas, 'OffCanvas');
|
|
474
|
+
}(jQuery);
|