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.
Files changed (160) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +2 -0
  4. data/_includes/footer.html +1 -0
  5. data/_includes/head.html +16 -0
  6. data/_includes/header.html +1 -0
  7. data/_includes/javascripts.html +4 -0
  8. data/_layouts/default.html +18 -0
  9. data/_layouts/home.html +26 -0
  10. data/_layouts/page.html +15 -0
  11. data/_layouts/post.html +25 -0
  12. data/_sass/_vendor/normalize-scss/sass/_normalize.scss +3 -0
  13. data/_sass/_vendor/normalize-scss/sass/normalize/_import-now.scss +11 -0
  14. data/_sass/_vendor/normalize-scss/sass/normalize/_normalize-mixin.scss +676 -0
  15. data/_sass/_vendor/normalize-scss/sass/normalize/_variables.scss +36 -0
  16. data/_sass/_vendor/normalize-scss/sass/normalize/_vertical-rhythm.scss +61 -0
  17. data/_sass/_vendor/sassy-lists/stylesheets/functions/_purge.scss +38 -0
  18. data/_sass/_vendor/sassy-lists/stylesheets/functions/_remove.scss +31 -0
  19. data/_sass/_vendor/sassy-lists/stylesheets/functions/_replace.scss +46 -0
  20. data/_sass/_vendor/sassy-lists/stylesheets/functions/_to-list.scss +27 -0
  21. data/_sass/_vendor/sassy-lists/stylesheets/helpers/_missing-dependencies.scss +25 -0
  22. data/_sass/_vendor/sassy-lists/stylesheets/helpers/_true.scss +13 -0
  23. data/_sass/foundation/_global.scss +219 -0
  24. data/_sass/foundation/components/_accordion-menu.scss +36 -0
  25. data/_sass/foundation/components/_accordion.scss +150 -0
  26. data/_sass/foundation/components/_badge.scss +63 -0
  27. data/_sass/foundation/components/_breadcrumbs.scss +97 -0
  28. data/_sass/foundation/components/_button-group.scss +249 -0
  29. data/_sass/foundation/components/_button.scss +303 -0
  30. data/_sass/foundation/components/_callout.scss +106 -0
  31. data/_sass/foundation/components/_card.scss +121 -0
  32. data/_sass/foundation/components/_close-button.scss +102 -0
  33. data/_sass/foundation/components/_drilldown.scss +93 -0
  34. data/_sass/foundation/components/_dropdown-menu.scss +226 -0
  35. data/_sass/foundation/components/_dropdown.scss +72 -0
  36. data/_sass/foundation/components/_flex-video.scss +1 -0
  37. data/_sass/foundation/components/_flex.scss +28 -0
  38. data/_sass/foundation/components/_float.scss +27 -0
  39. data/_sass/foundation/components/_label.scss +64 -0
  40. data/_sass/foundation/components/_media-object.scss +114 -0
  41. data/_sass/foundation/components/_menu-icon.scss +9 -0
  42. data/_sass/foundation/components/_menu.scss +371 -0
  43. data/_sass/foundation/components/_off-canvas.scss +329 -0
  44. data/_sass/foundation/components/_orbit.scss +196 -0
  45. data/_sass/foundation/components/_pagination.scss +193 -0
  46. data/_sass/foundation/components/_progress-bar.scss +64 -0
  47. data/_sass/foundation/components/_responsive-embed.scss +67 -0
  48. data/_sass/foundation/components/_reveal.scss +178 -0
  49. data/_sass/foundation/components/_slider.scss +138 -0
  50. data/_sass/foundation/components/_sticky.scss +38 -0
  51. data/_sass/foundation/components/_switch.scss +247 -0
  52. data/_sass/foundation/components/_table.scss +329 -0
  53. data/_sass/foundation/components/_tabs.scss +196 -0
  54. data/_sass/foundation/components/_thumbnail.scss +67 -0
  55. data/_sass/foundation/components/_title-bar.scss +84 -0
  56. data/_sass/foundation/components/_tooltip.scss +107 -0
  57. data/_sass/foundation/components/_top-bar.scss +173 -0
  58. data/_sass/foundation/components/_visibility.scss +132 -0
  59. data/_sass/foundation/forms/_checkbox.scss +41 -0
  60. data/_sass/foundation/forms/_error.scss +88 -0
  61. data/_sass/foundation/forms/_fieldset.scss +54 -0
  62. data/_sass/foundation/forms/_forms.scss +34 -0
  63. data/_sass/foundation/forms/_help-text.scss +30 -0
  64. data/_sass/foundation/forms/_input-group.scss +135 -0
  65. data/_sass/foundation/forms/_label.scss +50 -0
  66. data/_sass/foundation/forms/_meter.scss +110 -0
  67. data/_sass/foundation/forms/_progress.scss +94 -0
  68. data/_sass/foundation/forms/_range.scss +149 -0
  69. data/_sass/foundation/forms/_select.scss +85 -0
  70. data/_sass/foundation/forms/_text.scss +170 -0
  71. data/_sass/foundation/foundation.scss +118 -0
  72. data/_sass/foundation/grid/_classes.scss +176 -0
  73. data/_sass/foundation/grid/_column.scss +112 -0
  74. data/_sass/foundation/grid/_flex-grid.scss +307 -0
  75. data/_sass/foundation/grid/_grid.scss +44 -0
  76. data/_sass/foundation/grid/_gutter.scss +82 -0
  77. data/_sass/foundation/grid/_layout.scss +76 -0
  78. data/_sass/foundation/grid/_position.scss +76 -0
  79. data/_sass/foundation/grid/_row.scss +99 -0
  80. data/_sass/foundation/grid/_size.scss +24 -0
  81. data/_sass/foundation/settings/_settings.scss +621 -0
  82. data/_sass/foundation/typography/_alignment.scss +22 -0
  83. data/_sass/foundation/typography/_base.scss +509 -0
  84. data/_sass/foundation/typography/_helpers.scss +78 -0
  85. data/_sass/foundation/typography/_print.scss +81 -0
  86. data/_sass/foundation/typography/_typography.scss +26 -0
  87. data/_sass/foundation/util/_breakpoint.scss +281 -0
  88. data/_sass/foundation/util/_color.scss +126 -0
  89. data/_sass/foundation/util/_direction.scss +31 -0
  90. data/_sass/foundation/util/_flex.scss +85 -0
  91. data/_sass/foundation/util/_math.scss +72 -0
  92. data/_sass/foundation/util/_mixins.scss +276 -0
  93. data/_sass/foundation/util/_selector.scss +41 -0
  94. data/_sass/foundation/util/_unit.scss +152 -0
  95. data/_sass/foundation/util/_util.scss +13 -0
  96. data/_sass/foundation/util/_value.scss +140 -0
  97. data/assets/js/app.js +1 -0
  98. data/assets/js/vendor/foundation/foundation.d.ts +496 -0
  99. data/assets/js/vendor/foundation/foundation.js +10207 -0
  100. data/assets/js/vendor/foundation/foundation.min.js +4 -0
  101. data/assets/js/vendor/foundation/plugins/foundation.abide.js +637 -0
  102. data/assets/js/vendor/foundation/plugins/foundation.abide.min.js +1 -0
  103. data/assets/js/vendor/foundation/plugins/foundation.accordion.js +252 -0
  104. data/assets/js/vendor/foundation/plugins/foundation.accordion.min.js +1 -0
  105. data/assets/js/vendor/foundation/plugins/foundation.accordionMenu.js +318 -0
  106. data/assets/js/vendor/foundation/plugins/foundation.accordionMenu.min.js +1 -0
  107. data/assets/js/vendor/foundation/plugins/foundation.core.js +386 -0
  108. data/assets/js/vendor/foundation/plugins/foundation.core.min.js +1 -0
  109. data/assets/js/vendor/foundation/plugins/foundation.drilldown.js +565 -0
  110. data/assets/js/vendor/foundation/plugins/foundation.drilldown.min.js +1 -0
  111. data/assets/js/vendor/foundation/plugins/foundation.dropdown.js +465 -0
  112. data/assets/js/vendor/foundation/plugins/foundation.dropdown.min.js +1 -0
  113. data/assets/js/vendor/foundation/plugins/foundation.dropdownMenu.js +486 -0
  114. data/assets/js/vendor/foundation/plugins/foundation.dropdownMenu.min.js +1 -0
  115. data/assets/js/vendor/foundation/plugins/foundation.equalizer.js +374 -0
  116. data/assets/js/vendor/foundation/plugins/foundation.equalizer.min.js +1 -0
  117. data/assets/js/vendor/foundation/plugins/foundation.interchange.js +233 -0
  118. data/assets/js/vendor/foundation/plugins/foundation.interchange.min.js +1 -0
  119. data/assets/js/vendor/foundation/plugins/foundation.magellan.js +285 -0
  120. data/assets/js/vendor/foundation/plugins/foundation.magellan.min.js +1 -0
  121. data/assets/js/vendor/foundation/plugins/foundation.offcanvas.js +474 -0
  122. data/assets/js/vendor/foundation/plugins/foundation.offcanvas.min.js +1 -0
  123. data/assets/js/vendor/foundation/plugins/foundation.orbit.js +566 -0
  124. data/assets/js/vendor/foundation/plugins/foundation.orbit.min.js +1 -0
  125. data/assets/js/vendor/foundation/plugins/foundation.responsiveMenu.js +169 -0
  126. data/assets/js/vendor/foundation/plugins/foundation.responsiveMenu.min.js +1 -0
  127. data/assets/js/vendor/foundation/plugins/foundation.responsiveToggle.js +177 -0
  128. data/assets/js/vendor/foundation/plugins/foundation.responsiveToggle.min.js +1 -0
  129. data/assets/js/vendor/foundation/plugins/foundation.reveal.js +633 -0
  130. data/assets/js/vendor/foundation/plugins/foundation.reveal.min.js +1 -0
  131. data/assets/js/vendor/foundation/plugins/foundation.slider.js +762 -0
  132. data/assets/js/vendor/foundation/plugins/foundation.slider.min.js +1 -0
  133. data/assets/js/vendor/foundation/plugins/foundation.sticky.js +518 -0
  134. data/assets/js/vendor/foundation/plugins/foundation.sticky.min.js +1 -0
  135. data/assets/js/vendor/foundation/plugins/foundation.tabs.js +512 -0
  136. data/assets/js/vendor/foundation/plugins/foundation.tabs.min.js +1 -0
  137. data/assets/js/vendor/foundation/plugins/foundation.toggler.js +169 -0
  138. data/assets/js/vendor/foundation/plugins/foundation.toggler.min.js +1 -0
  139. data/assets/js/vendor/foundation/plugins/foundation.tooltip.js +492 -0
  140. data/assets/js/vendor/foundation/plugins/foundation.tooltip.min.js +1 -0
  141. data/assets/js/vendor/foundation/plugins/foundation.util.box.js +196 -0
  142. data/assets/js/vendor/foundation/plugins/foundation.util.box.min.js +1 -0
  143. data/assets/js/vendor/foundation/plugins/foundation.util.keyboard.js +163 -0
  144. data/assets/js/vendor/foundation/plugins/foundation.util.keyboard.min.js +1 -0
  145. data/assets/js/vendor/foundation/plugins/foundation.util.mediaQuery.js +233 -0
  146. data/assets/js/vendor/foundation/plugins/foundation.util.mediaQuery.min.js +1 -0
  147. data/assets/js/vendor/foundation/plugins/foundation.util.motion.js +103 -0
  148. data/assets/js/vendor/foundation/plugins/foundation.util.motion.min.js +1 -0
  149. data/assets/js/vendor/foundation/plugins/foundation.util.nest.js +74 -0
  150. data/assets/js/vendor/foundation/plugins/foundation.util.nest.min.js +1 -0
  151. data/assets/js/vendor/foundation/plugins/foundation.util.timerAndImageLoader.js +90 -0
  152. data/assets/js/vendor/foundation/plugins/foundation.util.timerAndImageLoader.min.js +1 -0
  153. data/assets/js/vendor/foundation/plugins/foundation.util.touch.js +352 -0
  154. data/assets/js/vendor/foundation/plugins/foundation.util.touch.min.js +1 -0
  155. data/assets/js/vendor/foundation/plugins/foundation.util.triggers.js +261 -0
  156. data/assets/js/vendor/foundation/plugins/foundation.util.triggers.min.js +1 -0
  157. data/assets/js/vendor/foundation/plugins/foundation.zf.responsiveAccordionTabs.js +262 -0
  158. data/assets/js/vendor/foundation/plugins/foundation.zf.responsiveAccordionTabs.min.js +1 -0
  159. data/assets/main.scss +6 -0
  160. metadata +232 -0
@@ -0,0 +1 @@
1
+ "use strict";function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function t(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}return function(e,i,s){return i&&t(e.prototype,i),s&&t(e,s),e}}();!function(t){function e(t,e){return t/e}function i(t,e,i,s){return Math.abs(t.position()[e]+t[s]()/2-i)}function s(t,e){return Math.log(e)/Math.log(t)}var n=function(){function n(e,i){_classCallCheck(this,n),this.$element=e,this.options=t.extend({},n.defaults,this.$element.data(),i),this._init(),Foundation.registerPlugin(this,"Slider"),Foundation.Keyboard.register("Slider",{ltr:{ARROW_RIGHT:"increase",ARROW_UP:"increase",ARROW_DOWN:"decrease",ARROW_LEFT:"decrease",SHIFT_ARROW_RIGHT:"increase_fast",SHIFT_ARROW_UP:"increase_fast",SHIFT_ARROW_DOWN:"decrease_fast",SHIFT_ARROW_LEFT:"decrease_fast"},rtl:{ARROW_LEFT:"increase",ARROW_RIGHT:"decrease",SHIFT_ARROW_LEFT:"increase_fast",SHIFT_ARROW_RIGHT:"decrease_fast"}})}return _createClass(n,[{key:"_init",value:function(){this.inputs=this.$element.find("input"),this.handles=this.$element.find("[data-slider-handle]"),this.$handle=this.handles.eq(0),this.$input=this.inputs.length?this.inputs.eq(0):t("#"+this.$handle.attr("aria-controls")),this.$fill=this.$element.find("[data-slider-fill]").css(this.options.vertical?"height":"width",0);var e=!1;(this.options.disabled||this.$element.hasClass(this.options.disabledClass))&&(this.options.disabled=!0,this.$element.addClass(this.options.disabledClass)),this.inputs.length||(this.inputs=t().add(this.$input),this.options.binding=!0),this._setInitAttr(0),this.handles[1]&&(this.options.doubleSided=!0,this.$handle2=this.handles.eq(1),this.$input2=this.inputs.length>1?this.inputs.eq(1):t("#"+this.$handle2.attr("aria-controls")),this.inputs[1]||(this.inputs=this.inputs.add(this.$input2)),e=!0,this._setInitAttr(1)),this.setHandles(),this._events()}},{key:"setHandles",value:function(){var t=this;this.handles[1]?this._setHandlePos(this.$handle,this.inputs.eq(0).val(),!0,function(){t._setHandlePos(t.$handle2,t.inputs.eq(1).val(),!0)}):this._setHandlePos(this.$handle,this.inputs.eq(0).val(),!0)}},{key:"_reflow",value:function(){this.setHandles()}},{key:"_pctOfBar",value:function(t){var i=e(t-this.options.start,this.options.end-this.options.start);switch(this.options.positionValueFunction){case"pow":i=this._logTransform(i);break;case"log":i=this._powTransform(i)}return i.toFixed(2)}},{key:"_value",value:function(t){switch(this.options.positionValueFunction){case"pow":t=this._powTransform(t);break;case"log":t=this._logTransform(t)}var e=(this.options.end-this.options.start)*t+this.options.start;return e}},{key:"_logTransform",value:function(t){return s(this.options.nonLinearBase,t*(this.options.nonLinearBase-1)+1)}},{key:"_powTransform",value:function(t){return(Math.pow(this.options.nonLinearBase,t)-1)/(this.options.nonLinearBase-1)}},{key:"_setHandlePos",value:function(t,i,s,n){if(!this.$element.hasClass(this.options.disabledClass)){i=parseFloat(i),i<this.options.start?i=this.options.start:i>this.options.end&&(i=this.options.end);var a=this.options.doubleSided;if(a)if(0===this.handles.index(t)){var o=parseFloat(this.$handle2.attr("aria-valuenow"));i=i>=o?o-this.options.step:i}else{var l=parseFloat(this.$handle.attr("aria-valuenow"));i=i<=l?l+this.options.step:i}this.options.vertical&&!s&&(i=this.options.end-i);var r=this,d=this.options.vertical,h=d?"height":"width",u=d?"top":"left",p=t[0].getBoundingClientRect()[h],f=this.$element[0].getBoundingClientRect()[h],c=this._pctOfBar(i),v=(f-p)*c,g=(100*e(v,f)).toFixed(this.options.decimal);i=parseFloat(i.toFixed(this.options.decimal));var _={};if(this._setValues(t,i),a){var m,$=0===this.handles.index(t),F=~~(100*e(p,f));if($)_[u]=g+"%",m=parseFloat(this.$handle2[0].style[u])-g+F,n&&"function"==typeof n&&n();else{var y=parseFloat(this.$handle[0].style[u]);m=g-(isNaN(y)?(this.options.initialStart-this.options.start)/((this.options.end-this.options.start)/100):y)+F}_["min-"+h]=m+"%"}this.$element.one("finished.zf.animate",function(){r.$element.trigger("moved.zf.slider",[t])});var R=this.$element.data("dragging")?1e3/60:this.options.moveTime;Foundation.Move(R,t,function(){isNaN(g)?t.css(u,100*c+"%"):t.css(u,g+"%"),r.options.doubleSided?r.$fill.css(_):r.$fill.css(h,100*c+"%")}),clearTimeout(r.timeout),r.timeout=setTimeout(function(){r.$element.trigger("changed.zf.slider",[t])},r.options.changedDelay)}}},{key:"_setInitAttr",value:function(t){var e=0===t?this.options.initialStart:this.options.initialEnd,i=this.inputs.eq(t).attr("id")||Foundation.GetYoDigits(6,"slider");this.inputs.eq(t).attr({id:i,max:this.options.end,min:this.options.start,step:this.options.step}),this.inputs.eq(t).val(e),this.handles.eq(t).attr({role:"slider","aria-controls":i,"aria-valuemax":this.options.end,"aria-valuemin":this.options.start,"aria-valuenow":e,"aria-orientation":this.options.vertical?"vertical":"horizontal",tabindex:0})}},{key:"_setValues",value:function(t,e){var i=this.options.doubleSided?this.handles.index(t):0;this.inputs.eq(i).val(e),t.attr("aria-valuenow",e)}},{key:"_handleEvent",value:function(s,n,a){var o,l;if(a)o=this._adjustValue(null,a),l=!0;else{s.preventDefault();var r=this,d=this.options.vertical,h=d?"height":"width",u=d?"top":"left",p=d?s.pageY:s.pageX,f=(this.$handle[0].getBoundingClientRect()[h]/2,this.$element[0].getBoundingClientRect()[h]),c=d?t(window).scrollTop():t(window).scrollLeft(),v=this.$element.offset()[u];s.clientY===s.pageY&&(p+=c);var g,_=p-v;g=_<0?0:_>f?f:_;var m=e(g,f);if(o=this._value(m),Foundation.rtl()&&!this.options.vertical&&(o=this.options.end-o),o=r._adjustValue(null,o),l=!1,!n){var $=i(this.$handle,u,g,h),F=i(this.$handle2,u,g,h);n=$<=F?this.$handle:this.$handle2}}this._setHandlePos(n,o,l)}},{key:"_adjustValue",value:function(t,e){var i,s,n,a,o=this.options.step,l=parseFloat(o/2);return i=t?parseFloat(t.attr("aria-valuenow")):e,s=i%o,n=i-s,a=n+o,0===s?i:i=i>=n+l?a:n}},{key:"_events",value:function(){this._eventsForHandle(this.$handle),this.handles[1]&&this._eventsForHandle(this.$handle2)}},{key:"_eventsForHandle",value:function(e){var i,s=this;if(this.inputs.off("change.zf.slider").on("change.zf.slider",function(e){var i=s.inputs.index(t(this));s._handleEvent(e,s.handles.eq(i),t(this).val())}),this.options.clickSelect&&this.$element.off("click.zf.slider").on("click.zf.slider",function(e){return!s.$element.data("dragging")&&void(t(e.target).is("[data-slider-handle]")||(s.options.doubleSided?s._handleEvent(e):s._handleEvent(e,s.$handle)))}),this.options.draggable){this.handles.addTouch();var n=t("body");e.off("mousedown.zf.slider").on("mousedown.zf.slider",function(a){e.addClass("is-dragging"),s.$fill.addClass("is-dragging"),s.$element.data("dragging",!0),i=t(a.currentTarget),n.on("mousemove.zf.slider",function(t){t.preventDefault(),s._handleEvent(t,i)}).on("mouseup.zf.slider",function(t){s._handleEvent(t,i),e.removeClass("is-dragging"),s.$fill.removeClass("is-dragging"),s.$element.data("dragging",!1),n.off("mousemove.zf.slider mouseup.zf.slider")})}).on("selectstart.zf.slider touchmove.zf.slider",function(t){t.preventDefault()})}e.off("keydown.zf.slider").on("keydown.zf.slider",function(e){var i,n=t(this),a=s.options.doubleSided?s.handles.index(n):0,o=parseFloat(s.inputs.eq(a).val());Foundation.Keyboard.handleKey(e,"Slider",{decrease:function(){i=o-s.options.step},increase:function(){i=o+s.options.step},decrease_fast:function(){i=o-10*s.options.step},increase_fast:function(){i=o+10*s.options.step},handled:function(){e.preventDefault(),s._setHandlePos(n,i,!0)}})})}},{key:"destroy",value:function(){this.handles.off(".zf.slider"),this.inputs.off(".zf.slider"),this.$element.off(".zf.slider"),clearTimeout(this.timeout),Foundation.unregisterPlugin(this)}}]),n}();n.defaults={start:0,end:100,step:1,initialStart:0,initialEnd:100,binding:!1,clickSelect:!0,vertical:!1,draggable:!0,disabled:!1,doubleSided:!1,decimal:2,moveTime:200,disabledClass:"disabled",invertVertical:!1,changedDelay:500,nonLinearBase:5,positionValueFunction:"linear"},Foundation.plugin(n,"Slider")}(jQuery);
@@ -0,0 +1,518 @@
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
+ * Sticky module.
11
+ * @module foundation.sticky
12
+ * @requires foundation.util.triggers
13
+ * @requires foundation.util.mediaQuery
14
+ */
15
+
16
+ var Sticky = function () {
17
+ /**
18
+ * Creates a new instance of a sticky thing.
19
+ * @class
20
+ * @param {jQuery} element - jQuery object to make sticky.
21
+ * @param {Object} options - options object passed when creating the element programmatically.
22
+ */
23
+ function Sticky(element, options) {
24
+ _classCallCheck(this, Sticky);
25
+
26
+ this.$element = element;
27
+ this.options = $.extend({}, Sticky.defaults, this.$element.data(), options);
28
+
29
+ this._init();
30
+
31
+ Foundation.registerPlugin(this, 'Sticky');
32
+ }
33
+
34
+ /**
35
+ * Initializes the sticky element by adding classes, getting/setting dimensions, breakpoints and attributes
36
+ * @function
37
+ * @private
38
+ */
39
+
40
+
41
+ _createClass(Sticky, [{
42
+ key: '_init',
43
+ value: function _init() {
44
+ var $parent = this.$element.parent('[data-sticky-container]'),
45
+ id = this.$element[0].id || Foundation.GetYoDigits(6, 'sticky'),
46
+ _this = this;
47
+
48
+ if (!$parent.length) {
49
+ this.wasWrapped = true;
50
+ }
51
+ this.$container = $parent.length ? $parent : $(this.options.container).wrapInner(this.$element);
52
+ this.$container.addClass(this.options.containerClass);
53
+
54
+ this.$element.addClass(this.options.stickyClass).attr({ 'data-resize': id });
55
+
56
+ this.scrollCount = this.options.checkEvery;
57
+ this.isStuck = false;
58
+ $(window).one('load.zf.sticky', function () {
59
+ //We calculate the container height to have correct values for anchor points offset calculation.
60
+ _this.containerHeight = _this.$element.css("display") == "none" ? 0 : _this.$element[0].getBoundingClientRect().height;
61
+ _this.$container.css('height', _this.containerHeight);
62
+ _this.elemHeight = _this.containerHeight;
63
+ if (_this.options.anchor !== '') {
64
+ _this.$anchor = $('#' + _this.options.anchor);
65
+ } else {
66
+ _this._parsePoints();
67
+ }
68
+
69
+ _this._setSizes(function () {
70
+ var scroll = window.pageYOffset;
71
+ _this._calc(false, scroll);
72
+ //Unstick the element will ensure that proper classes are set.
73
+ if (!_this.isStuck) {
74
+ _this._removeSticky(scroll >= _this.topPoint ? false : true);
75
+ }
76
+ });
77
+ _this._events(id.split('-').reverse().join('-'));
78
+ });
79
+ }
80
+
81
+ /**
82
+ * If using multiple elements as anchors, calculates the top and bottom pixel values the sticky thing should stick and unstick on.
83
+ * @function
84
+ * @private
85
+ */
86
+
87
+ }, {
88
+ key: '_parsePoints',
89
+ value: function _parsePoints() {
90
+ var top = this.options.topAnchor == "" ? 1 : this.options.topAnchor,
91
+ btm = this.options.btmAnchor == "" ? document.documentElement.scrollHeight : this.options.btmAnchor,
92
+ pts = [top, btm],
93
+ breaks = {};
94
+ for (var i = 0, len = pts.length; i < len && pts[i]; i++) {
95
+ var pt;
96
+ if (typeof pts[i] === 'number') {
97
+ pt = pts[i];
98
+ } else {
99
+ var place = pts[i].split(':'),
100
+ anchor = $('#' + place[0]);
101
+
102
+ pt = anchor.offset().top;
103
+ if (place[1] && place[1].toLowerCase() === 'bottom') {
104
+ pt += anchor[0].getBoundingClientRect().height;
105
+ }
106
+ }
107
+ breaks[i] = pt;
108
+ }
109
+
110
+ this.points = breaks;
111
+ return;
112
+ }
113
+
114
+ /**
115
+ * Adds event handlers for the scrolling element.
116
+ * @private
117
+ * @param {String} id - psuedo-random id for unique scroll event listener.
118
+ */
119
+
120
+ }, {
121
+ key: '_events',
122
+ value: function _events(id) {
123
+ var _this = this,
124
+ scrollListener = this.scrollListener = 'scroll.zf.' + id;
125
+ if (this.isOn) {
126
+ return;
127
+ }
128
+ if (this.canStick) {
129
+ this.isOn = true;
130
+ $(window).off(scrollListener).on(scrollListener, function (e) {
131
+ if (_this.scrollCount === 0) {
132
+ _this.scrollCount = _this.options.checkEvery;
133
+ _this._setSizes(function () {
134
+ _this._calc(false, window.pageYOffset);
135
+ });
136
+ } else {
137
+ _this.scrollCount--;
138
+ _this._calc(false, window.pageYOffset);
139
+ }
140
+ });
141
+ }
142
+
143
+ this.$element.off('resizeme.zf.trigger').on('resizeme.zf.trigger', function (e, el) {
144
+ _this._setSizes(function () {
145
+ _this._calc(false);
146
+ if (_this.canStick) {
147
+ if (!_this.isOn) {
148
+ _this._events(id);
149
+ }
150
+ } else if (_this.isOn) {
151
+ _this._pauseListeners(scrollListener);
152
+ }
153
+ });
154
+ });
155
+ }
156
+
157
+ /**
158
+ * Removes event handlers for scroll and change events on anchor.
159
+ * @fires Sticky#pause
160
+ * @param {String} scrollListener - unique, namespaced scroll listener attached to `window`
161
+ */
162
+
163
+ }, {
164
+ key: '_pauseListeners',
165
+ value: function _pauseListeners(scrollListener) {
166
+ this.isOn = false;
167
+ $(window).off(scrollListener);
168
+
169
+ /**
170
+ * Fires when the plugin is paused due to resize event shrinking the view.
171
+ * @event Sticky#pause
172
+ * @private
173
+ */
174
+ this.$element.trigger('pause.zf.sticky');
175
+ }
176
+
177
+ /**
178
+ * Called on every `scroll` event and on `_init`
179
+ * fires functions based on booleans and cached values
180
+ * @param {Boolean} checkSizes - true if plugin should recalculate sizes and breakpoints.
181
+ * @param {Number} scroll - current scroll position passed from scroll event cb function. If not passed, defaults to `window.pageYOffset`.
182
+ */
183
+
184
+ }, {
185
+ key: '_calc',
186
+ value: function _calc(checkSizes, scroll) {
187
+ if (checkSizes) {
188
+ this._setSizes();
189
+ }
190
+
191
+ if (!this.canStick) {
192
+ if (this.isStuck) {
193
+ this._removeSticky(true);
194
+ }
195
+ return false;
196
+ }
197
+
198
+ if (!scroll) {
199
+ scroll = window.pageYOffset;
200
+ }
201
+
202
+ if (scroll >= this.topPoint) {
203
+ if (scroll <= this.bottomPoint) {
204
+ if (!this.isStuck) {
205
+ this._setSticky();
206
+ }
207
+ } else {
208
+ if (this.isStuck) {
209
+ this._removeSticky(false);
210
+ }
211
+ }
212
+ } else {
213
+ if (this.isStuck) {
214
+ this._removeSticky(true);
215
+ }
216
+ }
217
+ }
218
+
219
+ /**
220
+ * Causes the $element to become stuck.
221
+ * Adds `position: fixed;`, and helper classes.
222
+ * @fires Sticky#stuckto
223
+ * @function
224
+ * @private
225
+ */
226
+
227
+ }, {
228
+ key: '_setSticky',
229
+ value: function _setSticky() {
230
+ var _this = this,
231
+ stickTo = this.options.stickTo,
232
+ mrgn = stickTo === 'top' ? 'marginTop' : 'marginBottom',
233
+ notStuckTo = stickTo === 'top' ? 'bottom' : 'top',
234
+ css = {};
235
+
236
+ css[mrgn] = this.options[mrgn] + 'em';
237
+ css[stickTo] = 0;
238
+ css[notStuckTo] = 'auto';
239
+ this.isStuck = true;
240
+ this.$element.removeClass('is-anchored is-at-' + notStuckTo).addClass('is-stuck is-at-' + stickTo).css(css)
241
+ /**
242
+ * Fires when the $element has become `position: fixed;`
243
+ * Namespaced to `top` or `bottom`, e.g. `sticky.zf.stuckto:top`
244
+ * @event Sticky#stuckto
245
+ */
246
+ .trigger('sticky.zf.stuckto:' + stickTo);
247
+ this.$element.on("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd", function () {
248
+ _this._setSizes();
249
+ });
250
+ }
251
+
252
+ /**
253
+ * Causes the $element to become unstuck.
254
+ * Removes `position: fixed;`, and helper classes.
255
+ * Adds other helper classes.
256
+ * @param {Boolean} isTop - tells the function if the $element should anchor to the top or bottom of its $anchor element.
257
+ * @fires Sticky#unstuckfrom
258
+ * @private
259
+ */
260
+
261
+ }, {
262
+ key: '_removeSticky',
263
+ value: function _removeSticky(isTop) {
264
+ var stickTo = this.options.stickTo,
265
+ stickToTop = stickTo === 'top',
266
+ css = {},
267
+ anchorPt = (this.points ? this.points[1] - this.points[0] : this.anchorHeight) - this.elemHeight,
268
+ mrgn = stickToTop ? 'marginTop' : 'marginBottom',
269
+ notStuckTo = stickToTop ? 'bottom' : 'top',
270
+ topOrBottom = isTop ? 'top' : 'bottom';
271
+
272
+ css[mrgn] = 0;
273
+
274
+ css['bottom'] = 'auto';
275
+ if (isTop) {
276
+ css['top'] = 0;
277
+ } else {
278
+ css['top'] = anchorPt;
279
+ }
280
+
281
+ this.isStuck = false;
282
+ this.$element.removeClass('is-stuck is-at-' + stickTo).addClass('is-anchored is-at-' + topOrBottom).css(css)
283
+ /**
284
+ * Fires when the $element has become anchored.
285
+ * Namespaced to `top` or `bottom`, e.g. `sticky.zf.unstuckfrom:bottom`
286
+ * @event Sticky#unstuckfrom
287
+ */
288
+ .trigger('sticky.zf.unstuckfrom:' + topOrBottom);
289
+ }
290
+
291
+ /**
292
+ * Sets the $element and $container sizes for plugin.
293
+ * Calls `_setBreakPoints`.
294
+ * @param {Function} cb - optional callback function to fire on completion of `_setBreakPoints`.
295
+ * @private
296
+ */
297
+
298
+ }, {
299
+ key: '_setSizes',
300
+ value: function _setSizes(cb) {
301
+ this.canStick = Foundation.MediaQuery.is(this.options.stickyOn);
302
+ if (!this.canStick) {
303
+ if (cb && typeof cb === 'function') {
304
+ cb();
305
+ }
306
+ }
307
+ var _this = this,
308
+ newElemWidth = this.$container[0].getBoundingClientRect().width,
309
+ comp = window.getComputedStyle(this.$container[0]),
310
+ pdngl = parseInt(comp['padding-left'], 10),
311
+ pdngr = parseInt(comp['padding-right'], 10);
312
+
313
+ if (this.$anchor && this.$anchor.length) {
314
+ this.anchorHeight = this.$anchor[0].getBoundingClientRect().height;
315
+ } else {
316
+ this._parsePoints();
317
+ }
318
+
319
+ this.$element.css({
320
+ 'max-width': newElemWidth - pdngl - pdngr + 'px'
321
+ });
322
+
323
+ var newContainerHeight = this.$element[0].getBoundingClientRect().height || this.containerHeight;
324
+ if (this.$element.css("display") == "none") {
325
+ newContainerHeight = 0;
326
+ }
327
+ this.containerHeight = newContainerHeight;
328
+ this.$container.css({
329
+ height: newContainerHeight
330
+ });
331
+ this.elemHeight = newContainerHeight;
332
+
333
+ if (!this.isStuck) {
334
+ if (this.$element.hasClass('is-at-bottom')) {
335
+ var anchorPt = (this.points ? this.points[1] - this.$container.offset().top : this.anchorHeight) - this.elemHeight;
336
+ this.$element.css('top', anchorPt);
337
+ }
338
+ }
339
+
340
+ this._setBreakPoints(newContainerHeight, function () {
341
+ if (cb && typeof cb === 'function') {
342
+ cb();
343
+ }
344
+ });
345
+ }
346
+
347
+ /**
348
+ * Sets the upper and lower breakpoints for the element to become sticky/unsticky.
349
+ * @param {Number} elemHeight - px value for sticky.$element height, calculated by `_setSizes`.
350
+ * @param {Function} cb - optional callback function to be called on completion.
351
+ * @private
352
+ */
353
+
354
+ }, {
355
+ key: '_setBreakPoints',
356
+ value: function _setBreakPoints(elemHeight, cb) {
357
+ if (!this.canStick) {
358
+ if (cb && typeof cb === 'function') {
359
+ cb();
360
+ } else {
361
+ return false;
362
+ }
363
+ }
364
+ var mTop = emCalc(this.options.marginTop),
365
+ mBtm = emCalc(this.options.marginBottom),
366
+ topPoint = this.points ? this.points[0] : this.$anchor.offset().top,
367
+ bottomPoint = this.points ? this.points[1] : topPoint + this.anchorHeight,
368
+
369
+ // topPoint = this.$anchor.offset().top || this.points[0],
370
+ // bottomPoint = topPoint + this.anchorHeight || this.points[1],
371
+ winHeight = window.innerHeight;
372
+
373
+ if (this.options.stickTo === 'top') {
374
+ topPoint -= mTop;
375
+ bottomPoint -= elemHeight + mTop;
376
+ } else if (this.options.stickTo === 'bottom') {
377
+ topPoint -= winHeight - (elemHeight + mBtm);
378
+ bottomPoint -= winHeight - mBtm;
379
+ } else {
380
+ //this would be the stickTo: both option... tricky
381
+ }
382
+
383
+ this.topPoint = topPoint;
384
+ this.bottomPoint = bottomPoint;
385
+
386
+ if (cb && typeof cb === 'function') {
387
+ cb();
388
+ }
389
+ }
390
+
391
+ /**
392
+ * Destroys the current sticky element.
393
+ * Resets the element to the top position first.
394
+ * Removes event listeners, JS-added css properties and classes, and unwraps the $element if the JS added the $container.
395
+ * @function
396
+ */
397
+
398
+ }, {
399
+ key: 'destroy',
400
+ value: function destroy() {
401
+ this._removeSticky(true);
402
+
403
+ this.$element.removeClass(this.options.stickyClass + ' is-anchored is-at-top').css({
404
+ height: '',
405
+ top: '',
406
+ bottom: '',
407
+ 'max-width': ''
408
+ }).off('resizeme.zf.trigger');
409
+ if (this.$anchor && this.$anchor.length) {
410
+ this.$anchor.off('change.zf.sticky');
411
+ }
412
+ $(window).off(this.scrollListener);
413
+
414
+ if (this.wasWrapped) {
415
+ this.$element.unwrap();
416
+ } else {
417
+ this.$container.removeClass(this.options.containerClass).css({
418
+ height: ''
419
+ });
420
+ }
421
+ Foundation.unregisterPlugin(this);
422
+ }
423
+ }]);
424
+
425
+ return Sticky;
426
+ }();
427
+
428
+ Sticky.defaults = {
429
+ /**
430
+ * Customizable container template. Add your own classes for styling and sizing.
431
+ * @option
432
+ * @type {string}
433
+ * @default '&lt;div data-sticky-container&gt;&lt;/div&gt;'
434
+ */
435
+ container: '<div data-sticky-container></div>',
436
+ /**
437
+ * Location in the view the element sticks to. Can be `'top'` or `'bottom'`.
438
+ * @option
439
+ * @type {string}
440
+ * @default 'top'
441
+ */
442
+ stickTo: 'top',
443
+ /**
444
+ * If anchored to a single element, the id of that element.
445
+ * @option
446
+ * @type {string}
447
+ * @default ''
448
+ */
449
+ anchor: '',
450
+ /**
451
+ * If using more than one element as anchor points, the id of the top anchor.
452
+ * @option
453
+ * @type {string}
454
+ * @default ''
455
+ */
456
+ topAnchor: '',
457
+ /**
458
+ * If using more than one element as anchor points, the id of the bottom anchor.
459
+ * @option
460
+ * @type {string}
461
+ * @default ''
462
+ */
463
+ btmAnchor: '',
464
+ /**
465
+ * Margin, in `em`'s to apply to the top of the element when it becomes sticky.
466
+ * @option
467
+ * @type {number}
468
+ * @default 1
469
+ */
470
+ marginTop: 1,
471
+ /**
472
+ * Margin, in `em`'s to apply to the bottom of the element when it becomes sticky.
473
+ * @option
474
+ * @type {number}
475
+ * @default 1
476
+ */
477
+ marginBottom: 1,
478
+ /**
479
+ * Breakpoint string that is the minimum screen size an element should become sticky.
480
+ * @option
481
+ * @type {string}
482
+ * @default 'medium'
483
+ */
484
+ stickyOn: 'medium',
485
+ /**
486
+ * Class applied to sticky element, and removed on destruction. Foundation defaults to `sticky`.
487
+ * @option
488
+ * @type {string}
489
+ * @default 'sticky'
490
+ */
491
+ stickyClass: 'sticky',
492
+ /**
493
+ * Class applied to sticky container. Foundation defaults to `sticky-container`.
494
+ * @option
495
+ * @type {string}
496
+ * @default 'sticky-container'
497
+ */
498
+ containerClass: 'sticky-container',
499
+ /**
500
+ * Number of scroll events between the plugin's recalculating sticky points. Setting it to `0` will cause it to recalc every scroll event, setting it to `-1` will prevent recalc on scroll.
501
+ * @option
502
+ * @type {number}
503
+ * @default -1
504
+ */
505
+ checkEvery: -1
506
+ };
507
+
508
+ /**
509
+ * Helper function to calculate em values
510
+ * @param Number {em} - number of em's to calculate into pixels
511
+ */
512
+ function emCalc(em) {
513
+ return parseInt(window.getComputedStyle(document.body, null).fontSize, 10) * em;
514
+ }
515
+
516
+ // Window exports
517
+ Foundation.plugin(Sticky, 'Sticky');
518
+ }(jQuery);