foundation6-jekyll-base 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- 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(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 s=i[e];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}return function(i,e,s){return e&&t(i.prototype,e),s&&t(i,s),i}}();!function(t){function i(t){return parseInt(window.getComputedStyle(document.body,null).fontSize,10)*t}var e=function(){function e(i,s){_classCallCheck(this,e),this.$element=i,this.options=t.extend({},e.defaults,this.$element.data(),s),this._init(),Foundation.registerPlugin(this,"Sticky")}return _createClass(e,[{key:"_init",value:function(){var i=this.$element.parent("[data-sticky-container]"),e=this.$element[0].id||Foundation.GetYoDigits(6,"sticky"),s=this;i.length||(this.wasWrapped=!0),this.$container=i.length?i:t(this.options.container).wrapInner(this.$element),this.$container.addClass(this.options.containerClass),this.$element.addClass(this.options.stickyClass).attr({"data-resize":e}),this.scrollCount=this.options.checkEvery,this.isStuck=!1,t(window).one("load.zf.sticky",function(){s.containerHeight="none"==s.$element.css("display")?0:s.$element[0].getBoundingClientRect().height,s.$container.css("height",s.containerHeight),s.elemHeight=s.containerHeight,""!==s.options.anchor?s.$anchor=t("#"+s.options.anchor):s._parsePoints(),s._setSizes(function(){var t=window.pageYOffset;s._calc(!1,t),s.isStuck||s._removeSticky(!(t>=s.topPoint))}),s._events(e.split("-").reverse().join("-"))})}},{key:"_parsePoints",value:function(){for(var i=""==this.options.topAnchor?1:this.options.topAnchor,e=""==this.options.btmAnchor?document.documentElement.scrollHeight:this.options.btmAnchor,s=[i,e],n={},o=0,c=s.length;o<c&&s[o];o++){var a;if("number"==typeof s[o])a=s[o];else{var h=s[o].split(":"),r=t("#"+h[0]);a=r.offset().top,h[1]&&"bottom"===h[1].toLowerCase()&&(a+=r[0].getBoundingClientRect().height)}n[o]=a}this.points=n}},{key:"_events",value:function(i){var e=this,s=this.scrollListener="scroll.zf."+i;this.isOn||(this.canStick&&(this.isOn=!0,t(window).off(s).on(s,function(t){0===e.scrollCount?(e.scrollCount=e.options.checkEvery,e._setSizes(function(){e._calc(!1,window.pageYOffset)})):(e.scrollCount--,e._calc(!1,window.pageYOffset))})),this.$element.off("resizeme.zf.trigger").on("resizeme.zf.trigger",function(t,n){e._setSizes(function(){e._calc(!1),e.canStick?e.isOn||e._events(i):e.isOn&&e._pauseListeners(s)})}))}},{key:"_pauseListeners",value:function(i){this.isOn=!1,t(window).off(i),this.$element.trigger("pause.zf.sticky")}},{key:"_calc",value:function(t,i){return t&&this._setSizes(),this.canStick?(i||(i=window.pageYOffset),void(i>=this.topPoint?i<=this.bottomPoint?this.isStuck||this._setSticky():this.isStuck&&this._removeSticky(!1):this.isStuck&&this._removeSticky(!0))):(this.isStuck&&this._removeSticky(!0),!1)}},{key:"_setSticky",value:function(){var t=this,i=this.options.stickTo,e="top"===i?"marginTop":"marginBottom",s="top"===i?"bottom":"top",n={};n[e]=this.options[e]+"em",n[i]=0,n[s]="auto",this.isStuck=!0,this.$element.removeClass("is-anchored is-at-"+s).addClass("is-stuck is-at-"+i).css(n).trigger("sticky.zf.stuckto:"+i),this.$element.on("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd",function(){t._setSizes()})}},{key:"_removeSticky",value:function(t){var i=this.options.stickTo,e="top"===i,s={},n=(this.points?this.points[1]-this.points[0]:this.anchorHeight)-this.elemHeight,o=e?"marginTop":"marginBottom",c=t?"top":"bottom";s[o]=0,s.bottom="auto",t?s.top=0:s.top=n,this.isStuck=!1,this.$element.removeClass("is-stuck is-at-"+i).addClass("is-anchored is-at-"+c).css(s).trigger("sticky.zf.unstuckfrom:"+c)}},{key:"_setSizes",value:function(t){this.canStick=Foundation.MediaQuery.is(this.options.stickyOn),this.canStick||t&&"function"==typeof t&&t();var i=this.$container[0].getBoundingClientRect().width,e=window.getComputedStyle(this.$container[0]),s=parseInt(e["padding-left"],10),n=parseInt(e["padding-right"],10);this.$anchor&&this.$anchor.length?this.anchorHeight=this.$anchor[0].getBoundingClientRect().height:this._parsePoints(),this.$element.css({"max-width":i-s-n+"px"});var o=this.$element[0].getBoundingClientRect().height||this.containerHeight;if("none"==this.$element.css("display")&&(o=0),this.containerHeight=o,this.$container.css({height:o}),this.elemHeight=o,!this.isStuck&&this.$element.hasClass("is-at-bottom")){var c=(this.points?this.points[1]-this.$container.offset().top:this.anchorHeight)-this.elemHeight;this.$element.css("top",c)}this._setBreakPoints(o,function(){t&&"function"==typeof t&&t()})}},{key:"_setBreakPoints",value:function(t,e){if(!this.canStick){if(!e||"function"!=typeof e)return!1;e()}var s=i(this.options.marginTop),n=i(this.options.marginBottom),o=this.points?this.points[0]:this.$anchor.offset().top,c=this.points?this.points[1]:o+this.anchorHeight,a=window.innerHeight;"top"===this.options.stickTo?(o-=s,c-=t+s):"bottom"===this.options.stickTo&&(o-=a-(t+n),c-=a-n),this.topPoint=o,this.bottomPoint=c,e&&"function"==typeof e&&e()}},{key:"destroy",value:function(){this._removeSticky(!0),this.$element.removeClass(this.options.stickyClass+" is-anchored is-at-top").css({height:"",top:"",bottom:"","max-width":""}).off("resizeme.zf.trigger"),this.$anchor&&this.$anchor.length&&this.$anchor.off("change.zf.sticky"),t(window).off(this.scrollListener),this.wasWrapped?this.$element.unwrap():this.$container.removeClass(this.options.containerClass).css({height:""}),Foundation.unregisterPlugin(this)}}]),e}();e.defaults={container:"<div data-sticky-container></div>",stickTo:"top",anchor:"",topAnchor:"",btmAnchor:"",marginTop:1,marginBottom:1,stickyOn:"medium",stickyClass:"sticky",containerClass:"sticky-container",checkEvery:-1},Foundation.plugin(e,"Sticky")}(jQuery);
|
@@ -0,0 +1,512 @@
|
|
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
|
+
* Tabs module.
|
11
|
+
* @module foundation.tabs
|
12
|
+
* @requires foundation.util.keyboard
|
13
|
+
* @requires foundation.util.timerAndImageLoader if tabs contain images
|
14
|
+
*/
|
15
|
+
|
16
|
+
var Tabs = function () {
|
17
|
+
/**
|
18
|
+
* Creates a new instance of tabs.
|
19
|
+
* @class
|
20
|
+
* @fires Tabs#init
|
21
|
+
* @param {jQuery} element - jQuery object to make into tabs.
|
22
|
+
* @param {Object} options - Overrides to the default plugin settings.
|
23
|
+
*/
|
24
|
+
function Tabs(element, options) {
|
25
|
+
_classCallCheck(this, Tabs);
|
26
|
+
|
27
|
+
this.$element = element;
|
28
|
+
this.options = $.extend({}, Tabs.defaults, this.$element.data(), options);
|
29
|
+
|
30
|
+
this._init();
|
31
|
+
Foundation.registerPlugin(this, 'Tabs');
|
32
|
+
Foundation.Keyboard.register('Tabs', {
|
33
|
+
'ENTER': 'open',
|
34
|
+
'SPACE': 'open',
|
35
|
+
'ARROW_RIGHT': 'next',
|
36
|
+
'ARROW_UP': 'previous',
|
37
|
+
'ARROW_DOWN': 'next',
|
38
|
+
'ARROW_LEFT': 'previous'
|
39
|
+
// 'TAB': 'next',
|
40
|
+
// 'SHIFT_TAB': 'previous'
|
41
|
+
});
|
42
|
+
}
|
43
|
+
|
44
|
+
/**
|
45
|
+
* Initializes the tabs by showing and focusing (if autoFocus=true) the preset active tab.
|
46
|
+
* @private
|
47
|
+
*/
|
48
|
+
|
49
|
+
|
50
|
+
_createClass(Tabs, [{
|
51
|
+
key: '_init',
|
52
|
+
value: function _init() {
|
53
|
+
var _this2 = this;
|
54
|
+
|
55
|
+
var _this = this;
|
56
|
+
|
57
|
+
this.$element.attr({ 'role': 'tablist' });
|
58
|
+
this.$tabTitles = this.$element.find('.' + this.options.linkClass);
|
59
|
+
this.$tabContent = $('[data-tabs-content="' + this.$element[0].id + '"]');
|
60
|
+
|
61
|
+
this.$tabTitles.each(function () {
|
62
|
+
var $elem = $(this),
|
63
|
+
$link = $elem.find('a'),
|
64
|
+
isActive = $elem.hasClass('' + _this.options.linkActiveClass),
|
65
|
+
hash = $link[0].hash.slice(1),
|
66
|
+
linkId = $link[0].id ? $link[0].id : hash + '-label',
|
67
|
+
$tabContent = $('#' + hash);
|
68
|
+
|
69
|
+
$elem.attr({ 'role': 'presentation' });
|
70
|
+
|
71
|
+
$link.attr({
|
72
|
+
'role': 'tab',
|
73
|
+
'aria-controls': hash,
|
74
|
+
'aria-selected': isActive,
|
75
|
+
'id': linkId
|
76
|
+
});
|
77
|
+
|
78
|
+
$tabContent.attr({
|
79
|
+
'role': 'tabpanel',
|
80
|
+
'aria-hidden': !isActive,
|
81
|
+
'aria-labelledby': linkId
|
82
|
+
});
|
83
|
+
|
84
|
+
if (isActive && _this.options.autoFocus) {
|
85
|
+
$(window).load(function () {
|
86
|
+
$('html, body').animate({ scrollTop: $elem.offset().top }, _this.options.deepLinkSmudgeDelay, function () {
|
87
|
+
$link.focus();
|
88
|
+
});
|
89
|
+
});
|
90
|
+
}
|
91
|
+
});
|
92
|
+
if (this.options.matchHeight) {
|
93
|
+
var $images = this.$tabContent.find('img');
|
94
|
+
|
95
|
+
if ($images.length) {
|
96
|
+
Foundation.onImagesLoaded($images, this._setHeight.bind(this));
|
97
|
+
} else {
|
98
|
+
this._setHeight();
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
//current context-bound function to open tabs on page load or history popstate
|
103
|
+
this._checkDeepLink = function () {
|
104
|
+
var anchor = window.location.hash;
|
105
|
+
//need a hash and a relevant anchor in this tabset
|
106
|
+
if (anchor.length) {
|
107
|
+
var $link = _this2.$element.find('[href="' + anchor + '"]');
|
108
|
+
if ($link.length) {
|
109
|
+
_this2.selectTab($(anchor), true);
|
110
|
+
|
111
|
+
//roll up a little to show the titles
|
112
|
+
if (_this2.options.deepLinkSmudge) {
|
113
|
+
var offset = _this2.$element.offset();
|
114
|
+
$('html, body').animate({ scrollTop: offset.top }, _this2.options.deepLinkSmudgeDelay);
|
115
|
+
}
|
116
|
+
|
117
|
+
/**
|
118
|
+
* Fires when the zplugin has deeplinked at pageload
|
119
|
+
* @event Tabs#deeplink
|
120
|
+
*/
|
121
|
+
_this2.$element.trigger('deeplink.zf.tabs', [$link, $(anchor)]);
|
122
|
+
}
|
123
|
+
}
|
124
|
+
};
|
125
|
+
|
126
|
+
//use browser to open a tab, if it exists in this tabset
|
127
|
+
if (this.options.deepLink) {
|
128
|
+
this._checkDeepLink();
|
129
|
+
}
|
130
|
+
|
131
|
+
this._events();
|
132
|
+
}
|
133
|
+
|
134
|
+
/**
|
135
|
+
* Adds event handlers for items within the tabs.
|
136
|
+
* @private
|
137
|
+
*/
|
138
|
+
|
139
|
+
}, {
|
140
|
+
key: '_events',
|
141
|
+
value: function _events() {
|
142
|
+
this._addKeyHandler();
|
143
|
+
this._addClickHandler();
|
144
|
+
this._setHeightMqHandler = null;
|
145
|
+
|
146
|
+
if (this.options.matchHeight) {
|
147
|
+
this._setHeightMqHandler = this._setHeight.bind(this);
|
148
|
+
|
149
|
+
$(window).on('changed.zf.mediaquery', this._setHeightMqHandler);
|
150
|
+
}
|
151
|
+
|
152
|
+
if (this.options.deepLink) {
|
153
|
+
$(window).on('popstate', this._checkDeepLink);
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
/**
|
158
|
+
* Adds click handlers for items within the tabs.
|
159
|
+
* @private
|
160
|
+
*/
|
161
|
+
|
162
|
+
}, {
|
163
|
+
key: '_addClickHandler',
|
164
|
+
value: function _addClickHandler() {
|
165
|
+
var _this = this;
|
166
|
+
|
167
|
+
this.$element.off('click.zf.tabs').on('click.zf.tabs', '.' + this.options.linkClass, function (e) {
|
168
|
+
e.preventDefault();
|
169
|
+
e.stopPropagation();
|
170
|
+
_this._handleTabChange($(this));
|
171
|
+
});
|
172
|
+
}
|
173
|
+
|
174
|
+
/**
|
175
|
+
* Adds keyboard event handlers for items within the tabs.
|
176
|
+
* @private
|
177
|
+
*/
|
178
|
+
|
179
|
+
}, {
|
180
|
+
key: '_addKeyHandler',
|
181
|
+
value: function _addKeyHandler() {
|
182
|
+
var _this = this;
|
183
|
+
|
184
|
+
this.$tabTitles.off('keydown.zf.tabs').on('keydown.zf.tabs', function (e) {
|
185
|
+
if (e.which === 9) return;
|
186
|
+
|
187
|
+
var $element = $(this),
|
188
|
+
$elements = $element.parent('ul').children('li'),
|
189
|
+
$prevElement,
|
190
|
+
$nextElement;
|
191
|
+
|
192
|
+
$elements.each(function (i) {
|
193
|
+
if ($(this).is($element)) {
|
194
|
+
if (_this.options.wrapOnKeys) {
|
195
|
+
$prevElement = i === 0 ? $elements.last() : $elements.eq(i - 1);
|
196
|
+
$nextElement = i === $elements.length - 1 ? $elements.first() : $elements.eq(i + 1);
|
197
|
+
} else {
|
198
|
+
$prevElement = $elements.eq(Math.max(0, i - 1));
|
199
|
+
$nextElement = $elements.eq(Math.min(i + 1, $elements.length - 1));
|
200
|
+
}
|
201
|
+
return;
|
202
|
+
}
|
203
|
+
});
|
204
|
+
|
205
|
+
// handle keyboard event with keyboard util
|
206
|
+
Foundation.Keyboard.handleKey(e, 'Tabs', {
|
207
|
+
open: function () {
|
208
|
+
$element.find('[role="tab"]').focus();
|
209
|
+
_this._handleTabChange($element);
|
210
|
+
},
|
211
|
+
previous: function () {
|
212
|
+
$prevElement.find('[role="tab"]').focus();
|
213
|
+
_this._handleTabChange($prevElement);
|
214
|
+
},
|
215
|
+
next: function () {
|
216
|
+
$nextElement.find('[role="tab"]').focus();
|
217
|
+
_this._handleTabChange($nextElement);
|
218
|
+
},
|
219
|
+
handled: function () {
|
220
|
+
e.stopPropagation();
|
221
|
+
e.preventDefault();
|
222
|
+
}
|
223
|
+
});
|
224
|
+
});
|
225
|
+
}
|
226
|
+
|
227
|
+
/**
|
228
|
+
* Opens the tab `$targetContent` defined by `$target`. Collapses active tab.
|
229
|
+
* @param {jQuery} $target - Tab to open.
|
230
|
+
* @param {boolean} historyHandled - browser has already handled a history update
|
231
|
+
* @fires Tabs#change
|
232
|
+
* @function
|
233
|
+
*/
|
234
|
+
|
235
|
+
}, {
|
236
|
+
key: '_handleTabChange',
|
237
|
+
value: function _handleTabChange($target, historyHandled) {
|
238
|
+
|
239
|
+
/**
|
240
|
+
* Check for active class on target. Collapse if exists.
|
241
|
+
*/
|
242
|
+
if ($target.hasClass('' + this.options.linkActiveClass)) {
|
243
|
+
if (this.options.activeCollapse) {
|
244
|
+
this._collapseTab($target);
|
245
|
+
|
246
|
+
/**
|
247
|
+
* Fires when the zplugin has successfully collapsed tabs.
|
248
|
+
* @event Tabs#collapse
|
249
|
+
*/
|
250
|
+
this.$element.trigger('collapse.zf.tabs', [$target]);
|
251
|
+
}
|
252
|
+
return;
|
253
|
+
}
|
254
|
+
|
255
|
+
var $oldTab = this.$element.find('.' + this.options.linkClass + '.' + this.options.linkActiveClass),
|
256
|
+
$tabLink = $target.find('[role="tab"]'),
|
257
|
+
hash = $tabLink[0].hash,
|
258
|
+
$targetContent = this.$tabContent.find(hash);
|
259
|
+
|
260
|
+
//close old tab
|
261
|
+
this._collapseTab($oldTab);
|
262
|
+
|
263
|
+
//open new tab
|
264
|
+
this._openTab($target);
|
265
|
+
|
266
|
+
//either replace or update browser history
|
267
|
+
if (this.options.deepLink && !historyHandled) {
|
268
|
+
var anchor = $target.find('a').attr('href');
|
269
|
+
|
270
|
+
if (this.options.updateHistory) {
|
271
|
+
history.pushState({}, '', anchor);
|
272
|
+
} else {
|
273
|
+
history.replaceState({}, '', anchor);
|
274
|
+
}
|
275
|
+
}
|
276
|
+
|
277
|
+
/**
|
278
|
+
* Fires when the plugin has successfully changed tabs.
|
279
|
+
* @event Tabs#change
|
280
|
+
*/
|
281
|
+
this.$element.trigger('change.zf.tabs', [$target, $targetContent]);
|
282
|
+
|
283
|
+
//fire to children a mutation event
|
284
|
+
$targetContent.find("[data-mutate]").trigger("mutateme.zf.trigger");
|
285
|
+
}
|
286
|
+
|
287
|
+
/**
|
288
|
+
* Opens the tab `$targetContent` defined by `$target`.
|
289
|
+
* @param {jQuery} $target - Tab to Open.
|
290
|
+
* @function
|
291
|
+
*/
|
292
|
+
|
293
|
+
}, {
|
294
|
+
key: '_openTab',
|
295
|
+
value: function _openTab($target) {
|
296
|
+
var $tabLink = $target.find('[role="tab"]'),
|
297
|
+
hash = $tabLink[0].hash,
|
298
|
+
$targetContent = this.$tabContent.find(hash);
|
299
|
+
|
300
|
+
$target.addClass('' + this.options.linkActiveClass);
|
301
|
+
|
302
|
+
$tabLink.attr({ 'aria-selected': 'true' });
|
303
|
+
|
304
|
+
$targetContent.addClass('' + this.options.panelActiveClass).attr({ 'aria-hidden': 'false' });
|
305
|
+
}
|
306
|
+
|
307
|
+
/**
|
308
|
+
* Collapses `$targetContent` defined by `$target`.
|
309
|
+
* @param {jQuery} $target - Tab to Open.
|
310
|
+
* @function
|
311
|
+
*/
|
312
|
+
|
313
|
+
}, {
|
314
|
+
key: '_collapseTab',
|
315
|
+
value: function _collapseTab($target) {
|
316
|
+
var $target_anchor = $target.removeClass('' + this.options.linkActiveClass).find('[role="tab"]').attr({ 'aria-selected': 'false' });
|
317
|
+
|
318
|
+
$('#' + $target_anchor.attr('aria-controls')).removeClass('' + this.options.panelActiveClass).attr({ 'aria-hidden': 'true' });
|
319
|
+
}
|
320
|
+
|
321
|
+
/**
|
322
|
+
* Public method for selecting a content pane to display.
|
323
|
+
* @param {jQuery | String} elem - jQuery object or string of the id of the pane to display.
|
324
|
+
* @param {boolean} historyHandled - browser has already handled a history update
|
325
|
+
* @function
|
326
|
+
*/
|
327
|
+
|
328
|
+
}, {
|
329
|
+
key: 'selectTab',
|
330
|
+
value: function selectTab(elem, historyHandled) {
|
331
|
+
var idStr;
|
332
|
+
|
333
|
+
if (typeof elem === 'object') {
|
334
|
+
idStr = elem[0].id;
|
335
|
+
} else {
|
336
|
+
idStr = elem;
|
337
|
+
}
|
338
|
+
|
339
|
+
if (idStr.indexOf('#') < 0) {
|
340
|
+
idStr = '#' + idStr;
|
341
|
+
}
|
342
|
+
|
343
|
+
var $target = this.$tabTitles.find('[href="' + idStr + '"]').parent('.' + this.options.linkClass);
|
344
|
+
|
345
|
+
this._handleTabChange($target, historyHandled);
|
346
|
+
}
|
347
|
+
}, {
|
348
|
+
key: '_setHeight',
|
349
|
+
|
350
|
+
/**
|
351
|
+
* Sets the height of each panel to the height of the tallest panel.
|
352
|
+
* If enabled in options, gets called on media query change.
|
353
|
+
* If loading content via external source, can be called directly or with _reflow.
|
354
|
+
* If enabled with `data-match-height="true"`, tabs sets to equal height
|
355
|
+
* @function
|
356
|
+
* @private
|
357
|
+
*/
|
358
|
+
value: function _setHeight() {
|
359
|
+
var max = 0,
|
360
|
+
_this = this; // Lock down the `this` value for the root tabs object
|
361
|
+
|
362
|
+
this.$tabContent.find('.' + this.options.panelClass).css('height', '').each(function () {
|
363
|
+
|
364
|
+
var panel = $(this),
|
365
|
+
isActive = panel.hasClass('' + _this.options.panelActiveClass); // get the options from the parent instead of trying to get them from the child
|
366
|
+
|
367
|
+
if (!isActive) {
|
368
|
+
panel.css({ 'visibility': 'hidden', 'display': 'block' });
|
369
|
+
}
|
370
|
+
|
371
|
+
var temp = this.getBoundingClientRect().height;
|
372
|
+
|
373
|
+
if (!isActive) {
|
374
|
+
panel.css({
|
375
|
+
'visibility': '',
|
376
|
+
'display': ''
|
377
|
+
});
|
378
|
+
}
|
379
|
+
|
380
|
+
max = temp > max ? temp : max;
|
381
|
+
}).css('height', max + 'px');
|
382
|
+
}
|
383
|
+
|
384
|
+
/**
|
385
|
+
* Destroys an instance of an tabs.
|
386
|
+
* @fires Tabs#destroyed
|
387
|
+
*/
|
388
|
+
|
389
|
+
}, {
|
390
|
+
key: 'destroy',
|
391
|
+
value: function destroy() {
|
392
|
+
this.$element.find('.' + this.options.linkClass).off('.zf.tabs').hide().end().find('.' + this.options.panelClass).hide();
|
393
|
+
|
394
|
+
if (this.options.matchHeight) {
|
395
|
+
if (this._setHeightMqHandler != null) {
|
396
|
+
$(window).off('changed.zf.mediaquery', this._setHeightMqHandler);
|
397
|
+
}
|
398
|
+
}
|
399
|
+
|
400
|
+
if (this.options.deepLink) {
|
401
|
+
$(window).off('popstate', this._checkDeepLink);
|
402
|
+
}
|
403
|
+
|
404
|
+
Foundation.unregisterPlugin(this);
|
405
|
+
}
|
406
|
+
}]);
|
407
|
+
|
408
|
+
return Tabs;
|
409
|
+
}();
|
410
|
+
|
411
|
+
Tabs.defaults = {
|
412
|
+
/**
|
413
|
+
* Allows the window to scroll to content of pane specified by hash anchor
|
414
|
+
* @option
|
415
|
+
* @type {boolean}
|
416
|
+
* @default false
|
417
|
+
*/
|
418
|
+
deepLink: false,
|
419
|
+
|
420
|
+
/**
|
421
|
+
* Adjust the deep link scroll to make sure the top of the tab panel is visible
|
422
|
+
* @option
|
423
|
+
* @type {boolean}
|
424
|
+
* @default false
|
425
|
+
*/
|
426
|
+
deepLinkSmudge: false,
|
427
|
+
|
428
|
+
/**
|
429
|
+
* Animation time (ms) for the deep link adjustment
|
430
|
+
* @option
|
431
|
+
* @type {number}
|
432
|
+
* @default 300
|
433
|
+
*/
|
434
|
+
deepLinkSmudgeDelay: 300,
|
435
|
+
|
436
|
+
/**
|
437
|
+
* Update the browser history with the open tab
|
438
|
+
* @option
|
439
|
+
* @type {boolean}
|
440
|
+
* @default false
|
441
|
+
*/
|
442
|
+
updateHistory: false,
|
443
|
+
|
444
|
+
/**
|
445
|
+
* Allows the window to scroll to content of active pane on load if set to true.
|
446
|
+
* Not recommended if more than one tab panel per page.
|
447
|
+
* @option
|
448
|
+
* @type {boolean}
|
449
|
+
* @default false
|
450
|
+
*/
|
451
|
+
autoFocus: false,
|
452
|
+
|
453
|
+
/**
|
454
|
+
* Allows keyboard input to 'wrap' around the tab links.
|
455
|
+
* @option
|
456
|
+
* @type {boolean}
|
457
|
+
* @default true
|
458
|
+
*/
|
459
|
+
wrapOnKeys: true,
|
460
|
+
|
461
|
+
/**
|
462
|
+
* Allows the tab content panes to match heights if set to true.
|
463
|
+
* @option
|
464
|
+
* @type {boolean}
|
465
|
+
* @default false
|
466
|
+
*/
|
467
|
+
matchHeight: false,
|
468
|
+
|
469
|
+
/**
|
470
|
+
* Allows active tabs to collapse when clicked.
|
471
|
+
* @option
|
472
|
+
* @type {boolean}
|
473
|
+
* @default false
|
474
|
+
*/
|
475
|
+
activeCollapse: false,
|
476
|
+
|
477
|
+
/**
|
478
|
+
* Class applied to `li`'s in tab link list.
|
479
|
+
* @option
|
480
|
+
* @type {string}
|
481
|
+
* @default 'tabs-title'
|
482
|
+
*/
|
483
|
+
linkClass: 'tabs-title',
|
484
|
+
|
485
|
+
/**
|
486
|
+
* Class applied to the active `li` in tab link list.
|
487
|
+
* @option
|
488
|
+
* @type {string}
|
489
|
+
* @default 'is-active'
|
490
|
+
*/
|
491
|
+
linkActiveClass: 'is-active',
|
492
|
+
|
493
|
+
/**
|
494
|
+
* Class applied to the content containers.
|
495
|
+
* @option
|
496
|
+
* @type {string}
|
497
|
+
* @default 'tabs-panel'
|
498
|
+
*/
|
499
|
+
panelClass: 'tabs-panel',
|
500
|
+
|
501
|
+
/**
|
502
|
+
* Class applied to the active content container.
|
503
|
+
* @option
|
504
|
+
* @type {string}
|
505
|
+
* @default 'is-active'
|
506
|
+
*/
|
507
|
+
panelActiveClass: 'is-active'
|
508
|
+
};
|
509
|
+
|
510
|
+
// Window exports
|
511
|
+
Foundation.plugin(Tabs, 'Tabs');
|
512
|
+
}(jQuery);
|