zurb-foundation 3.2.5 → 4.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (239) hide show
  1. data/.gitignore +6 -2
  2. data/CHANGELOG.md +1 -26
  3. data/CONTRIBUTING.md +18 -0
  4. data/Gemfile.lock +19 -0
  5. data/Gruntfile.js +27 -0
  6. data/README.md +5 -6
  7. data/{Capfile → docs/Capfile} +0 -1
  8. data/docs/Gemfile +8 -0
  9. data/docs/Gemfile.lock +43 -0
  10. data/docs/Procfile +2 -0
  11. data/docs/README.md +1 -0
  12. data/docs/_sidebar-components.html.erb +109 -0
  13. data/docs/_sidebar.html.erb +109 -0
  14. data/docs/_zurb-jobs.html.erb +5 -0
  15. data/docs/changelog.html.erb +185 -0
  16. data/docs/compile.rb +43 -0
  17. data/docs/components/alert-boxes.html.erb +202 -0
  18. data/docs/components/block-grid.html.erb +118 -0
  19. data/docs/components/breadcrumbs.html.erb +146 -0
  20. data/docs/components/button-groups.html.erb +174 -0
  21. data/docs/components/buttons.html.erb +220 -0
  22. data/docs/components/clearing.html.erb +152 -0
  23. data/docs/components/custom-forms.html.erb +306 -0
  24. data/docs/components/dropdown-buttons.html.erb +233 -0
  25. data/docs/components/dropdown.html.erb +186 -0
  26. data/docs/components/flex-video.html.erb +93 -0
  27. data/docs/components/forms.html.erb +468 -0
  28. data/docs/components/grid.html.erb +355 -0
  29. data/docs/components/inline-lists.html.erb +89 -0
  30. data/docs/components/joyride.html.erb +178 -0
  31. data/docs/components/keystrokes.html.erb +74 -0
  32. data/docs/components/labels.html.erb +98 -0
  33. data/docs/components/magellan.html.erb +84 -0
  34. data/docs/components/orbit.html.erb +262 -0
  35. data/docs/components/pagination.html.erb +181 -0
  36. data/docs/components/panels.html.erb +121 -0
  37. data/docs/components/pricing-tables.html.erb +154 -0
  38. data/docs/components/progress-bars.html.erb +120 -0
  39. data/docs/components/reveal.html.erb +147 -0
  40. data/docs/components/section.html.erb +156 -0
  41. data/docs/components/side-nav.html.erb +122 -0
  42. data/docs/components/split-buttons.html.erb +218 -0
  43. data/docs/components/sub-nav.html.erb +120 -0
  44. data/docs/components/switch.html.erb +288 -0
  45. data/docs/components/tables.html.erb +123 -0
  46. data/docs/components/thumbnails.html.erb +87 -0
  47. data/docs/components/tooltips.html.erb +73 -0
  48. data/docs/components/top-bar.html.erb +219 -0
  49. data/docs/components/type.html.erb +359 -0
  50. data/docs/components/visibility.html.erb +102 -0
  51. data/docs/config.ru +12 -0
  52. data/docs/config/deploy.rb +33 -0
  53. data/docs/controller.rb +43 -0
  54. data/docs/css/_coderay.scss +116 -0
  55. data/docs/css/_settings.scss +1 -0
  56. data/docs/css/docs.scss +174 -0
  57. data/docs/css/normalize.scss +396 -0
  58. data/docs/css/qunit-composite.css +13 -0
  59. data/docs/css/qunit.css +235 -0
  60. data/docs/faq.html.erb +61 -0
  61. data/docs/img/demos/demo1-th.png +0 -0
  62. data/docs/img/demos/demo1.png +0 -0
  63. data/docs/img/demos/demo2-th.png +0 -0
  64. data/docs/img/demos/demo2.png +0 -0
  65. data/docs/img/demos/demo3-th.png +0 -0
  66. data/docs/img/demos/demo3.png +0 -0
  67. data/docs/img/demos/demo4-th.png +0 -0
  68. data/docs/img/demos/demo4.png +0 -0
  69. data/docs/img/demos/demo5-th.png +0 -0
  70. data/docs/img/demos/demo5.png +0 -0
  71. data/docs/index.html.erb +299 -0
  72. data/docs/javascript.html.erb +133 -0
  73. data/docs/js/docs.js +3 -0
  74. data/docs/js/qunit-composite.js +105 -0
  75. data/docs/js/qunit.js +1977 -0
  76. data/docs/js/tests/tabs/simple_tabs.html +57 -0
  77. data/docs/js/tests/tabs/simple_tabs.js +54 -0
  78. data/docs/js/tests/tooltips/tooltips.html +39 -0
  79. data/docs/js/tests/tooltips/tooltips.js +11 -0
  80. data/docs/layout.html.erb +99 -0
  81. data/docs/rails.html.erb +66 -0
  82. data/docs/sass.html.erb +299 -0
  83. data/docs/support.html.erb +134 -0
  84. data/foundation.gemspec +2 -4
  85. data/index.html +3 -23
  86. data/js/foundation/foundation.alerts.js +50 -0
  87. data/js/foundation/foundation.clearing.js +478 -0
  88. data/{vendor/assets/javascripts/foundation/jquery.cookie.js → js/foundation/foundation.cookie.js} +3 -1
  89. data/js/foundation/foundation.dropdown.js +122 -0
  90. data/js/foundation/foundation.forms.js +403 -0
  91. data/js/foundation/foundation.joyride.js +613 -0
  92. data/js/foundation/foundation.js +331 -0
  93. data/js/foundation/foundation.magellan.js +130 -0
  94. data/js/foundation/foundation.orbit.js +355 -0
  95. data/{vendor/assets/javascripts/foundation/jquery.placeholder.js → js/foundation/foundation.placeholder.js} +4 -2
  96. data/js/foundation/foundation.reveal.js +264 -0
  97. data/js/foundation/foundation.section.js +180 -0
  98. data/js/foundation/foundation.tooltips.js +195 -0
  99. data/js/foundation/foundation.topbar.js +187 -0
  100. data/js/foundation/index.js +16 -0
  101. data/{vendor/assets/javascripts/foundation/modernizr.foundation.js → js/vendor/custom.modernizr.js} +0 -0
  102. data/js/vendor/jquery.js +9597 -0
  103. data/js/vendor/zepto.js +1782 -0
  104. data/lib/foundation/engine.rb +8 -1
  105. data/lib/foundation/generators/install_generator.rb +24 -1
  106. data/lib/foundation/generators/templates/application.html.erb +20 -6
  107. data/lib/foundation/generators/templates/application.html.haml +2 -6
  108. data/lib/foundation/generators/templates/application.html.slim +2 -5
  109. data/lib/foundation/version.rb +1 -1
  110. data/lib/zurb-foundation.rb +7 -9
  111. data/package.json +9 -0
  112. data/scss/foundation.scss +42 -15
  113. data/scss/foundation/_foundation-global.scss +226 -0
  114. data/scss/foundation/components/_alert-boxes.scss +106 -0
  115. data/scss/foundation/components/_block-grid.scss +63 -0
  116. data/scss/foundation/components/_breadcrumbs.scss +117 -0
  117. data/scss/foundation/components/_button-groups.scss +59 -0
  118. data/scss/foundation/components/_buttons.scss +217 -0
  119. data/scss/foundation/components/_clearing.scss +209 -0
  120. data/scss/foundation/components/_custom-forms.scss +232 -0
  121. data/scss/foundation/components/_dropdown-buttons.scss +114 -0
  122. data/scss/foundation/components/_dropdown.scss +137 -0
  123. data/scss/foundation/components/_flex-video.scss +45 -0
  124. data/scss/foundation/components/_forms.scss +309 -0
  125. data/scss/foundation/components/_grid.scss +149 -71
  126. data/scss/foundation/components/_inline-lists.scss +47 -0
  127. data/scss/foundation/components/_joyride.scss +193 -0
  128. data/scss/foundation/components/_keystrokes.scss +56 -0
  129. data/scss/foundation/components/_labels.scss +81 -0
  130. data/scss/foundation/components/_magellan.scss +15 -0
  131. data/scss/foundation/components/_orbit.scss +193 -0
  132. data/scss/foundation/components/_pagination.scss +99 -0
  133. data/scss/foundation/components/_panels.scss +76 -0
  134. data/scss/foundation/components/_pricing-tables.scss +130 -0
  135. data/scss/foundation/components/_progress-bars.scss +68 -0
  136. data/scss/foundation/components/_reveal.scss +131 -0
  137. data/scss/foundation/components/_section.scss +194 -0
  138. data/scss/foundation/components/_side-nav.scss +68 -0
  139. data/scss/foundation/components/_split-buttons.scss +159 -0
  140. data/scss/foundation/components/_sub-nav.scss +67 -0
  141. data/scss/foundation/components/_switch.scss +242 -0
  142. data/scss/foundation/components/_tables.scss +80 -0
  143. data/scss/foundation/components/_thumbs.scss +45 -0
  144. data/scss/foundation/components/_tooltips.scss +113 -0
  145. data/scss/foundation/components/_top-bar.scss +443 -0
  146. data/scss/foundation/components/_type.scss +411 -0
  147. data/scss/foundation/components/_visibility.scss +117 -0
  148. data/scss/normalize.scss +396 -0
  149. data/templates/project/config.rb +26 -0
  150. data/templates/project/index.html +28 -43
  151. data/templates/project/manifest.rb +21 -28
  152. data/templates/project/scss/_settings.scss +4 -243
  153. data/templates/project/scss/app.scss +37 -44
  154. data/templates/project/scss/normalize.scss +396 -0
  155. data/test/stylesheets/styles.css +955 -0
  156. metadata +144 -153
  157. data/config/deploy.rb +0 -42
  158. data/lib/foundation/generators/layout_generator.rb +0 -28
  159. data/scss/foundation/_settings.scss +0 -281
  160. data/scss/foundation/common/_base.scss +0 -4
  161. data/scss/foundation/common/_forms.scss +0 -117
  162. data/scss/foundation/common/_globals.scss +0 -35
  163. data/scss/foundation/common/_ratios.scss +0 -19
  164. data/scss/foundation/common/_typography.scss +0 -104
  165. data/scss/foundation/components/modules/_all.scss +0 -10
  166. data/scss/foundation/components/modules/_buttons.scss +0 -178
  167. data/scss/foundation/components/modules/_clearing.scss +0 -61
  168. data/scss/foundation/components/modules/_joyride.scss +0 -33
  169. data/scss/foundation/components/modules/_mqueries.scss +0 -458
  170. data/scss/foundation/components/modules/_navbar.scss +0 -74
  171. data/scss/foundation/components/modules/_offcanvas.scss +0 -55
  172. data/scss/foundation/components/modules/_orbit.scss +0 -90
  173. data/scss/foundation/components/modules/_reveal.scss +0 -34
  174. data/scss/foundation/components/modules/_tabs.scss +0 -67
  175. data/scss/foundation/components/modules/_topbar.scss +0 -167
  176. data/scss/foundation/components/modules/_ui.scss +0 -292
  177. data/scss/foundation/functions/_all.scss +0 -2
  178. data/scss/foundation/functions/_convert-number-to-word.scss +0 -10
  179. data/scss/foundation/functions/_grid-calc.scss +0 -5
  180. data/scss/foundation/functions/modular-scale.scss +0 -3
  181. data/scss/foundation/mixins/_all.scss +0 -5
  182. data/scss/foundation/mixins/_clearfix.scss +0 -13
  183. data/scss/foundation/mixins/_css-triangle.scss +0 -22
  184. data/scss/foundation/mixins/_font-size.scss +0 -13
  185. data/scss/foundation/mixins/_respond-to.scss +0 -11
  186. data/scss/foundation/mixins/_semantic-grid.scss +0 -66
  187. data/test/buttons.html +0 -189
  188. data/test/clearing.html +0 -85
  189. data/test/config.rb +0 -11
  190. data/test/elements.html +0 -490
  191. data/test/forms.html +0 -371
  192. data/test/grid.html +0 -543
  193. data/test/images/orbit-demo/demo1.jpeg +0 -0
  194. data/test/images/orbit-demo/demo2.jpeg +0 -0
  195. data/test/images/orbit-demo/demo3.jpeg +0 -0
  196. data/test/images/orbit-demo/slider-background.jpeg +0 -0
  197. data/test/index.html +0 -83
  198. data/test/joyride.html +0 -127
  199. data/test/magellan.html +0 -112
  200. data/test/navigation.html +0 -269
  201. data/test/orbit.html +0 -112
  202. data/test/reveal.html +0 -91
  203. data/test/scss/_settings.scss +0 -245
  204. data/test/scss/styles.scss +0 -50
  205. data/test/tabs.html +0 -197
  206. data/test/template.html +0 -52
  207. data/test/topbar-login.html +0 -194
  208. data/test/topbar.html +0 -139
  209. data/test/type.html +0 -188
  210. data/vendor/assets/images/foundation/orbit/bullets.jpg +0 -0
  211. data/vendor/assets/images/foundation/orbit/left-arrow-small.png +0 -0
  212. data/vendor/assets/images/foundation/orbit/left-arrow.png +0 -0
  213. data/vendor/assets/images/foundation/orbit/loading.gif +0 -0
  214. data/vendor/assets/images/foundation/orbit/mask-black.png +0 -0
  215. data/vendor/assets/images/foundation/orbit/pause-black.png +0 -0
  216. data/vendor/assets/images/foundation/orbit/right-arrow-small.png +0 -0
  217. data/vendor/assets/images/foundation/orbit/right-arrow.png +0 -0
  218. data/vendor/assets/images/foundation/orbit/rotator-black.png +0 -0
  219. data/vendor/assets/images/foundation/orbit/timer-black.png +0 -0
  220. data/vendor/assets/javascripts/foundation/app.js +0 -41
  221. data/vendor/assets/javascripts/foundation/index.js +0 -19
  222. data/vendor/assets/javascripts/foundation/jquery.event.move.js +0 -580
  223. data/vendor/assets/javascripts/foundation/jquery.event.swipe.js +0 -130
  224. data/vendor/assets/javascripts/foundation/jquery.foundation.accordion.js +0 -47
  225. data/vendor/assets/javascripts/foundation/jquery.foundation.alerts.js +0 -20
  226. data/vendor/assets/javascripts/foundation/jquery.foundation.buttons.js +0 -83
  227. data/vendor/assets/javascripts/foundation/jquery.foundation.clearing.js +0 -413
  228. data/vendor/assets/javascripts/foundation/jquery.foundation.forms.js +0 -502
  229. data/vendor/assets/javascripts/foundation/jquery.foundation.joyride.js +0 -639
  230. data/vendor/assets/javascripts/foundation/jquery.foundation.magellan.js +0 -96
  231. data/vendor/assets/javascripts/foundation/jquery.foundation.mediaQueryToggle.js +0 -27
  232. data/vendor/assets/javascripts/foundation/jquery.foundation.navigation.js +0 -55
  233. data/vendor/assets/javascripts/foundation/jquery.foundation.orbit.js +0 -919
  234. data/vendor/assets/javascripts/foundation/jquery.foundation.reveal.js +0 -794
  235. data/vendor/assets/javascripts/foundation/jquery.foundation.tabs.js +0 -66
  236. data/vendor/assets/javascripts/foundation/jquery.foundation.tooltips.js +0 -211
  237. data/vendor/assets/javascripts/foundation/jquery.foundation.topbar.js +0 -174
  238. data/vendor/assets/javascripts/foundation/jquery.js +0 -9555
  239. data/vendor/assets/javascripts/foundation/jquery.offcanvas.js +0 -50
@@ -0,0 +1,180 @@
1
+ /*jslint unparam: true, browser: true, indent: 2 */
2
+
3
+ ;(function ($, window, document, undefined) {
4
+ 'use strict';
5
+
6
+ Foundation.libs.section = {
7
+ name: 'section',
8
+
9
+ version : '4.0.0',
10
+
11
+ settings : {
12
+ deep_linking: false,
13
+ one_up: true,
14
+ callback: function (){}
15
+ },
16
+
17
+ init : function (scope, method, options) {
18
+ this.scope = scope || this.scope;
19
+ Foundation.inherit(this, 'throttle data_options');
20
+
21
+ if (typeof method === 'object') {
22
+ $.extend(true, this.settings, method);
23
+ }
24
+
25
+ if (typeof method != 'string') {
26
+ this.set_active_from_hash();
27
+ if (!this.settings.init) this.events();
28
+
29
+ return this.settings.init;
30
+ } else {
31
+ return this[method].call(this, options);
32
+ }
33
+ },
34
+
35
+ events : function () {
36
+ var self = this;
37
+ $(this.scope).on('click.fndtn.section', '[data-section] .title', function (e) {
38
+ $.extend(true, self.settings, self.data_options($(this).closest('[data-section]')));
39
+ self.toggle_active.call(this, e, self);
40
+ });
41
+
42
+ $(window).on('resize.fndtn.section', self.throttle(function () {
43
+ self.resize.call(this);
44
+ }, 30)).trigger('resize');
45
+
46
+ this.settings.init = true;
47
+ },
48
+
49
+ toggle_active : function (e, self) {
50
+ var $this = $(this),
51
+ section = $this.closest('section, .section'),
52
+ content = section.find('.content'),
53
+ parent = section.closest('[data-section]'),
54
+ self = Foundation.libs.section;
55
+
56
+ if (!self.settings.deep_linking && content.length > 0) {
57
+ e.preventDefault();
58
+ }
59
+
60
+ if (section.hasClass('active')) {
61
+ if (self.small(parent)
62
+ || self.is_vertical(parent)
63
+ || self.is_accordion(parent)) {
64
+ section
65
+ .removeClass('active')
66
+ .attr('style', '');
67
+ }
68
+ } else {
69
+ if (self.small(parent) || self.settings.one_up) {
70
+ $this
71
+ .closest('[data-section]')
72
+ .find('section, .section')
73
+ .removeClass('active')
74
+ .attr('style', '');
75
+
76
+ section.css('padding-top', self.outerHeight(section.find('.title')) - 1);
77
+ }
78
+
79
+ if (self.small(parent)) {
80
+ section.attr('style', '');
81
+ }
82
+
83
+ section.addClass('active');
84
+ }
85
+
86
+ self.settings.callback();
87
+ },
88
+
89
+ resize : function () {
90
+ var sections = $('[data-section]'),
91
+ self = Foundation.libs.section;
92
+
93
+ sections.each(function() {
94
+ var $this = $(this),
95
+ active_section = $this.find('section.active, .section.active');
96
+ if (active_section.length > 1) {
97
+ active_section
98
+ .not(':first')
99
+ .removeClass('active')
100
+ .attr('style', '');
101
+ } else if (active_section.length < 1
102
+ && !self.is_vertical($this)
103
+ && !self.is_accordion($this)) {
104
+ var first = $this.find('section, .section').first();
105
+ first.addClass('active');
106
+
107
+ if (self.small($this)) {
108
+ first.attr('style', '');
109
+ } else {
110
+ first.css('padding-top', self.outerHeight(first.find('.title')) - 1);
111
+ }
112
+ }
113
+
114
+ if (self.small($this)) {
115
+ active_section.attr('style', '');
116
+ } else {
117
+ active_section.css('padding-top', self.outerHeight(active_section.find('.title')) - 1);
118
+ }
119
+ self.position_titles($this);
120
+ });
121
+ },
122
+
123
+ is_vertical : function (el) {
124
+ return el.hasClass('vertical-nav');
125
+ },
126
+
127
+ is_accordion : function (el) {
128
+ return el.hasClass('accordion');
129
+ },
130
+
131
+ set_active_from_hash : function () {
132
+ var hash = window.location.hash.substring(1),
133
+ sections = $('[data-section]')
134
+ self = this;
135
+
136
+ sections.each(function () {
137
+ var section = $(this);
138
+ $.extend(true, self.settings, self.data_options(section));
139
+
140
+ if (hash.length > 0 && self.settings.deep_linking) {
141
+ section
142
+ .find('.content[data-slug="' + hash + '"]')
143
+ .closest('section, .section')
144
+ .addClass('active');
145
+ }
146
+ });
147
+ },
148
+
149
+ position_titles : function (section, off) {
150
+ var titles = section.find('.title'),
151
+ previous_width = 0,
152
+ self = this;
153
+
154
+ if (typeof off === 'boolean') {
155
+ titles.attr('style', '');
156
+ } else {
157
+ titles.each(function () {
158
+ $(this).css('left', previous_width);
159
+ previous_width += self.outerWidth($(this));
160
+ });
161
+ }
162
+ },
163
+
164
+ small : function (el) {
165
+ if (el && this.is_accordion(el)) {
166
+ return true;
167
+ }
168
+ if ($('html').hasClass('lt-ie9')) {
169
+ return true;
170
+ }
171
+ return $(this.scope).width() < 768;
172
+ },
173
+
174
+ off : function () {
175
+ $(this.scope).off('.fndtn.section');
176
+ $(window).off('.fndtn.section');
177
+ this.settings.init = false;
178
+ }
179
+ };
180
+ }(Foundation.zj, this, this.document));
@@ -0,0 +1,195 @@
1
+ /*jslint unparam: true, browser: true, indent: 2 */
2
+
3
+ ;(function ($, window, document, undefined) {
4
+ 'use strict';
5
+
6
+ Foundation.libs.tooltips = {
7
+ name: 'tooltips',
8
+
9
+ version : '4.0.0',
10
+
11
+ settings : {
12
+ selector : '.has-tip',
13
+ additionalInheritableClasses : [],
14
+ tooltipClass : '.tooltip',
15
+ tipTemplate : function (selector, content) {
16
+ return '<span data-selector="' + selector + '" class="'
17
+ + Foundation.libs.tooltips.settings.tooltipClass.substring(1)
18
+ + '">' + content + '<span class="nub"></span></span>';
19
+ }
20
+ },
21
+
22
+ cache : {},
23
+
24
+ init : function (scope, method, options) {
25
+ var self = this;
26
+ this.scope = scope || this.scope;
27
+
28
+ if (typeof method === 'object') {
29
+ $.extend(true, this.settings, method);
30
+ }
31
+
32
+ if (typeof method != 'string') {
33
+ if (Modernizr.touch) {
34
+ $(this.scope)
35
+ .on('click.fndtn.tooltip touchstart.fndtn.tooltip touchend.fndtn.tooltip',
36
+ '[data-tooltip]', function (e) {
37
+ e.preventDefault();
38
+ $(self.settings.tooltipClass).hide();
39
+ self.showOrCreateTip($(this));
40
+ })
41
+ .on('click.fndtn.tooltip touchstart.fndtn.tooltip touchend.fndtn.tooltip',
42
+ this.settings.tooltipClass, function (e) {
43
+ e.preventDefault();
44
+ $(this).fadeOut(150);
45
+ });
46
+ } else {
47
+ $(this.scope)
48
+ .on('mouseenter.fndtn.tooltip mouseleave.fndtn.tooltip',
49
+ '[data-tooltip]', function (e) {
50
+ var $this = $(this);
51
+
52
+ if (e.type === 'mouseover' || e.type === 'mouseenter') {
53
+ self.showOrCreateTip($this);
54
+ } else if (e.type === 'mouseout' || e.type === 'mouseleave') {
55
+ self.hide($this);
56
+ }
57
+ });
58
+ }
59
+
60
+ // $(this.scope).data('fndtn-tooltips', true);
61
+ } else {
62
+ return this[method].call(this, options);
63
+ }
64
+
65
+ },
66
+
67
+ showOrCreateTip : function ($target) {
68
+ var $tip = this.getTip($target);
69
+
70
+ if ($tip && $tip.length > 0) {
71
+ return this.show($target);
72
+ }
73
+
74
+ return this.create($target);
75
+ },
76
+
77
+ getTip : function ($target) {
78
+ var selector = this.selector($target),
79
+ tip = null;
80
+
81
+ if (selector) {
82
+ tip = $('span[data-selector=' + selector + ']' + this.settings.tooltipClass);
83
+ }
84
+
85
+ return (typeof tip === 'object') ? tip : false;
86
+ },
87
+
88
+ selector : function ($target) {
89
+ var id = $target.attr('id'),
90
+ dataSelector = $target.attr('data-tooltip') || $target.attr('data-selector');
91
+
92
+ if ((id && id.length < 1 || !id) && typeof dataSelector != 'string') {
93
+ dataSelector = 'tooltip' + Math.random().toString(36).substring(7);
94
+ $target.attr('data-selector', dataSelector);
95
+ }
96
+
97
+ return (id && id.length > 0) ? id : dataSelector;
98
+ },
99
+
100
+ create : function ($target) {
101
+ var $tip = $(this.settings.tipTemplate(this.selector($target), $('<div>').html($target.attr('title')).html())),
102
+ classes = this.inheritable_classes($target);
103
+
104
+ $tip.addClass(classes).appendTo('body');
105
+ if (Modernizr.touch) {
106
+ $tip.append('<span class="tap-to-close">tap to close </span>');
107
+ }
108
+ $target.attr('title', '');
109
+ this.show($target);
110
+ },
111
+
112
+ reposition : function (target, tip, classes) {
113
+ var width, nub, nubHeight, nubWidth, column, objPos;
114
+
115
+ tip.css('visibility', 'hidden').show();
116
+
117
+ width = target.data('width');
118
+ nub = tip.children('.nub');
119
+ nubHeight = this.outerHeight(nub);
120
+ nubWidth = this.outerHeight(nub);
121
+
122
+ objPos = function (obj, top, right, bottom, left, width) {
123
+ return obj.css({
124
+ 'top' : (top) ? top : 'auto',
125
+ 'bottom' : (bottom) ? bottom : 'auto',
126
+ 'left' : (left) ? left : 'auto',
127
+ 'right' : (right) ? right : 'auto',
128
+ 'width' : (width) ? width : 'auto'
129
+ }).end();
130
+ };
131
+
132
+ objPos(tip, (target.offset().top + this.outerHeight(target) + 10), 'auto', 'auto', target.offset().left, width);
133
+
134
+ if ($(window).width() < 767) {
135
+ objPos(tip, (target.offset().top + this.outerHeight(target) + 10), 'auto', 'auto', 12.5, $(this.scope).width());
136
+ tip.addClass('tip-override');
137
+ objPos(nub, -nubHeight, 'auto', 'auto', target.offset().left);
138
+ } else {
139
+ objPos(tip, (target.offset().top + this.outerHeight(target) + 10), 'auto', 'auto', target.offset().left, width);
140
+ tip.removeClass('tip-override');
141
+ if (classes && classes.indexOf('tip-top') > -1) {
142
+ objPos(tip, (target.offset().top - this.outerHeight(tip)), 'auto', 'auto', target.offset().left, width)
143
+ .removeClass('tip-override');
144
+ } else if (classes && classes.indexOf('tip-left') > -1) {
145
+ objPos(tip, (target.offset().top + (this.outerHeight(target) / 2) - nubHeight*2.5), 'auto', 'auto', (target.offset().left - this.outerWidth(tip) - nubHeight), width)
146
+ .removeClass('tip-override');
147
+ } else if (classes && classes.indexOf('tip-right') > -1) {
148
+ objPos(tip, (target.offset().top + (this.outerHeight(target) / 2) - nubHeight*2.5), 'auto', 'auto', (target.offset().left + this.outerWidth(target) + nubHeight), width)
149
+ .removeClass('tip-override');
150
+ }
151
+ }
152
+
153
+ tip.css('visibility', 'visible').hide();
154
+ },
155
+
156
+ inheritable_classes : function (target) {
157
+ var inheritables = ['tip-top', 'tip-left', 'tip-bottom', 'tip-right', 'noradius'].concat(this.settings.additionalInheritableClasses),
158
+ classes = target.attr('class'),
159
+ filtered = classes ? $.map(classes.split(' '), function (el, i) {
160
+ if ($.inArray(el, inheritables) !== -1) {
161
+ return el;
162
+ }
163
+ }).join(' ') : '';
164
+
165
+ return $.trim(filtered);
166
+ },
167
+
168
+ show : function ($target) {
169
+ var $tip = this.getTip($target);
170
+
171
+ this.reposition($target, $tip, $target.attr('class'));
172
+ $tip.fadeIn(150);
173
+ },
174
+
175
+ hide : function ($target) {
176
+ var $tip = this.getTip($target);
177
+
178
+ $tip.fadeOut(150);
179
+ },
180
+
181
+ // deprecate reload
182
+ reload : function () {
183
+ var $self = $(this);
184
+
185
+ return ($self.data('fndtn-tooltips')) ? $self.foundationTooltips('destroy').foundationTooltips('init') : $self.foundationTooltips('init');
186
+ },
187
+
188
+ off : function () {
189
+ $(this.scope).off('.fndtn.tooltip');
190
+ $(this.settings.tooltipClass).each(function (i) {
191
+ $('[data-tooltip]').get(i).attr('title', $(this).text());
192
+ }).remove();
193
+ }
194
+ };
195
+ }(Foundation.zj, this, this.document));
@@ -0,0 +1,187 @@
1
+ /*jslint unparam: true, browser: true, indent: 2 */
2
+
3
+ ;(function ($, window, document, undefined) {
4
+ 'use strict';
5
+
6
+ Foundation.libs.topbar = {
7
+ name : 'topbar',
8
+
9
+ version : '4.0.0',
10
+
11
+ settings : {
12
+ index : 0,
13
+ stickyClass : 'sticky',
14
+ init : false
15
+ },
16
+
17
+ init : function (scope, method, options) {
18
+ this.scope = scope || this.scope;
19
+
20
+ if (typeof method === 'object') {
21
+ $.extend(true, this.settings, method);
22
+ }
23
+
24
+ if (typeof method != 'string') {
25
+ this.settings.$w = $(window);
26
+ this.settings.$topbar = $('nav.top-bar');
27
+ this.settings.$section = this.settings.$topbar.find('section');
28
+ this.settings.$titlebar = this.settings.$topbar.children('ul').first();
29
+
30
+ var breakpoint = $("<div class='top-bar-js-breakpoint'/>").appendTo("body");
31
+ this.settings.breakPoint = breakpoint.width();
32
+ breakpoint.remove();
33
+
34
+ if (!this.settings.init) {
35
+ this.events();
36
+ this.assemble();
37
+ }
38
+
39
+ if (!this.settings.height) this.largestUL();
40
+
41
+ if (this.settings.$topbar.parent().hasClass('fixed')) {
42
+ $('body').css('padding-top', this.outerHeight(this.settings.$topbar));
43
+ }
44
+
45
+ return this.settings.init;
46
+ } else {
47
+ // fire method
48
+ return this[method].call(this, options);
49
+ }
50
+ },
51
+
52
+ events : function () {
53
+ $(this.scope)
54
+ .on('click.fndtn.topbar', '.top-bar .toggle-topbar', function (e) {
55
+ e.preventDefault();
56
+
57
+ if (this.breakpoint()) {
58
+ this.settings.$topbar.toggleClass('expanded');
59
+ this.settings.$topbar.css('min-height', '');
60
+ }
61
+
62
+ if (!this.settings.$topbar.hasClass('expanded')) {
63
+ this.settings.$section.css({left: '0%'});
64
+ this.settings.$section.find('>.name').css({left: '100%'});
65
+ this.settings.$section.find('li.moved').removeClass('moved');
66
+ this.settings.index = 0;
67
+ }
68
+ }.bind(this))
69
+
70
+ .on('click.fndtn.topbar', '.top-bar .has-dropdown>a', function (e) {
71
+ var self = Foundation.libs.topbar;
72
+
73
+ if (Modernizr.touch || self.breakpoint())
74
+ e.preventDefault();
75
+
76
+ if (self.breakpoint()) {
77
+ var $this = $(this),
78
+ $selectedLi = $this.closest('li');
79
+
80
+ self.settings.index += 1;
81
+ $selectedLi.addClass('moved');
82
+ self.settings.$section.css({left: -(100 * self.settings.index) + '%'});
83
+ self.settings.$section.find('>.name').css({left: 100 * self.settings.index + '%'});
84
+
85
+ $this.siblings('ul')
86
+ .height(self.settings.height + self.outerHeight(self.settings.$titlebar, true));
87
+ self.settings.$topbar
88
+ .css('min-height', self.settings.height + self.outerHeight(self.settings.$titlebar, true) * 2)
89
+ }
90
+ });
91
+
92
+ $(window).on('resize.fndtn.topbar', function () {
93
+ if (!this.breakpoint()) {
94
+ this.settings.$topbar.css('min-height', '');
95
+ }
96
+ }.bind(this));
97
+
98
+ // Go up a level on Click
99
+ $(this.scope).on('click.fndtn', '.top-bar .has-dropdown .back', function (e) {
100
+ e.preventDefault();
101
+
102
+ var $this = $(this),
103
+ self = Foundation.libs.topbar,
104
+ $movedLi = $this.closest('li.moved'),
105
+ $previousLevelUl = $movedLi.parent();
106
+
107
+ self.settings.index -= 1;
108
+ self.settings.$section.css({left: -(100 * self.settings.index) + '%'});
109
+ self.settings.$section.find('>.name').css({'left': 100 * self.settings.index + '%'});
110
+
111
+ if (self.settings.index === 0) {
112
+ self.settings.$topbar.css('min-height', 0);
113
+ }
114
+
115
+ setTimeout(function () {
116
+ $movedLi.removeClass('moved');
117
+ }, 300);
118
+ });
119
+ },
120
+
121
+ breakpoint : function () {
122
+ return this.settings.$w.width() <= this.settings.breakPoint || $('html').hasClass('lt-ie9');
123
+ },
124
+
125
+ assemble : function () {
126
+ // Pull element out of the DOM for manipulation
127
+ this.settings.$section.detach();
128
+
129
+ this.settings.$section.find('.has-dropdown>a').each(function () {
130
+ var $link = $(this),
131
+ $dropdown = $link.siblings('.dropdown'),
132
+ $titleLi = $('<li class="title back js-generated"><h5><a href="#">&laquo; Back</a></h5></li>');
133
+ // Copy link to subnav
134
+ $dropdown.prepend($titleLi);
135
+ });
136
+
137
+ // Put element back in the DOM
138
+ this.settings.$section.appendTo(this.settings.$topbar);
139
+
140
+ // check for sticky
141
+ this.sticky();
142
+ },
143
+
144
+ largestUL : function () {
145
+ var uls = this.settings.$topbar.find('section ul ul'),
146
+ largest = uls.first(),
147
+ total = 0,
148
+ self = this;
149
+
150
+ uls.each(function () {
151
+ if ($(this).children('li').length > largest.children('li').length) {
152
+ largest = $(this);
153
+ }
154
+ });
155
+
156
+ largest.children('li').each(function () { total += self.outerHeight($(this), true); });
157
+
158
+ this.settings.height = total;
159
+ },
160
+
161
+ sticky : function () {
162
+ var klass = '.' + this.stickyClass;
163
+ if ($(klass).length > 0) {
164
+ var distance = $(klass).length ? $(klass).offset().top: 0,
165
+ $window = $(window);
166
+ var offst = this.outerHeight($('nav.top-bar'))+20;
167
+
168
+ $window.scroll(function() {
169
+ if ($window.scrollTop() >= (distance)) {
170
+ $(klass).addClass("fixed");
171
+ $('body').css('padding-top',offst);
172
+ }
173
+
174
+ else if ($window.scrollTop() < distance) {
175
+ $(klass).removeClass("fixed");
176
+ $('body').css('padding-top','0');
177
+ }
178
+ });
179
+ }
180
+ },
181
+
182
+ off : function () {
183
+ $(this.scope).off('.fndtn.topbar');
184
+ $(window).off('.fndtn.topbar');
185
+ }
186
+ };
187
+ }(Foundation.zj, this, this.document));