zurb-foundation 4.2.3 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. data/CONTRIBUTING.md +1 -1
  2. data/Gemfile.lock +1 -1
  3. data/README.md +8 -0
  4. data/docs/CHANGELOG.md +17 -0
  5. data/docs/README.md +3 -1
  6. data/docs/_sidebar-components.html.erb +2 -1
  7. data/docs/_sidebar.html.erb +2 -1
  8. data/docs/compile.rb +8 -1
  9. data/docs/components/abide.html.erb +371 -0
  10. data/docs/components/alert-boxes.html.erb +12 -9
  11. data/docs/components/block-grid.html.erb +1 -1
  12. data/docs/components/breadcrumbs.html.erb +7 -5
  13. data/docs/components/button-groups.html.erb +4 -2
  14. data/docs/components/buttons.html.erb +13 -9
  15. data/docs/components/clearing.html.erb +2 -0
  16. data/docs/components/dropdown-buttons.html.erb +59 -55
  17. data/docs/components/dropdown.html.erb +34 -32
  18. data/docs/components/flex-video.html.erb +4 -2
  19. data/docs/components/forms.html.erb +16 -15
  20. data/docs/components/global.html.erb +27 -4
  21. data/docs/components/grid.html.erb +21 -3
  22. data/docs/components/inline-lists.html.erb +8 -3
  23. data/docs/components/joyride.html.erb +5 -3
  24. data/docs/components/keystrokes.html.erb +4 -2
  25. data/docs/components/kitchen-sink.html.erb +15 -40
  26. data/docs/components/labels.html.erb +4 -2
  27. data/docs/components/magellan.html.erb +4 -2
  28. data/docs/components/orbit.html.erb +39 -27
  29. data/docs/components/pagination.html.erb +10 -8
  30. data/docs/components/panels.html.erb +7 -3
  31. data/docs/components/pricing-tables.html.erb +12 -10
  32. data/docs/components/progress-bars.html.erb +6 -4
  33. data/docs/components/reveal.html.erb +7 -28
  34. data/docs/components/section.html.erb +15 -13
  35. data/docs/components/side-nav.html.erb +5 -3
  36. data/docs/components/split-buttons.html.erb +45 -43
  37. data/docs/components/sub-nav.html.erb +7 -5
  38. data/docs/components/switch.html.erb +3 -1
  39. data/docs/components/tables.html.erb +8 -6
  40. data/docs/components/thumbnails.html.erb +2 -0
  41. data/docs/components/tooltips.html.erb +6 -4
  42. data/docs/components/top-bar.html.erb +9 -8
  43. data/docs/components/type.html.erb +20 -18
  44. data/docs/config.ru +2 -1
  45. data/docs/css/_footer.scss +420 -0
  46. data/docs/css/_offcanvas.scss +140 -0
  47. data/docs/css/docs.scss +10 -1
  48. data/docs/fonts/ProximaNova-Reg-webfont.eot +0 -0
  49. data/docs/fonts/ProximaNova-Reg-webfont.svg +244 -0
  50. data/docs/fonts/ProximaNova-Reg-webfont.ttf +0 -0
  51. data/docs/fonts/ProximaNova-Reg-webfont.woff +0 -0
  52. data/docs/fonts/proximanovacond-bold-webfont.eot +0 -0
  53. data/docs/fonts/proximanovacond-bold-webfont.svg +247 -0
  54. data/docs/fonts/proximanovacond-bold-webfont.ttf +0 -0
  55. data/docs/fonts/proximanovacond-bold-webfont.woff +0 -0
  56. data/docs/img/demos/orbit/demo1.jpg +0 -0
  57. data/docs/img/demos/orbit/demo2.jpg +0 -0
  58. data/docs/img/demos/orbit/demo3.jpg +0 -0
  59. data/docs/img/icons/footer-icons.png +0 -0
  60. data/docs/img/icons/footer-top-icons.png +0 -0
  61. data/docs/img/icons/social.png +0 -0
  62. data/docs/img/offcanvas/footer-icons.png +0 -0
  63. data/docs/img/offcanvas/menu-wht.png +0 -0
  64. data/docs/img/offcanvas/search.png +0 -0
  65. data/docs/img/offcanvas/zurb-logo.png +0 -0
  66. data/docs/img/offcanvas/zurb-wht.png +0 -0
  67. data/docs/js/docs.js +1 -0
  68. data/docs/js/jquery.offcanvas.js +28 -0
  69. data/docs/layout.html.erb +226 -42
  70. data/docs/media-queries.html.erb +3 -3
  71. data/docs/sass.html.erb +142 -142
  72. data/docs/support.html.erb +1 -1
  73. data/js/foundation/foundation.abide.js +194 -0
  74. data/js/foundation/foundation.dropdown.js +8 -9
  75. data/js/foundation/foundation.forms.js +11 -3
  76. data/js/foundation/foundation.interchange.js +25 -16
  77. data/js/foundation/foundation.joyride.js +9 -3
  78. data/js/foundation/foundation.js +2 -3
  79. data/js/foundation/foundation.magellan.js +3 -2
  80. data/js/foundation/foundation.orbit.js +359 -344
  81. data/js/foundation/foundation.reveal.js +1 -1
  82. data/js/foundation/foundation.section.js +290 -311
  83. data/js/foundation/foundation.tooltips.js +2 -2
  84. data/js/foundation/foundation.topbar.js +20 -23
  85. data/js/foundation/index.js +1 -0
  86. data/js/vendor/jquery.js +103 -121
  87. data/lib/foundation/generators/templates/application.html.slim +15 -8
  88. data/lib/foundation/version.rb +1 -1
  89. data/scss/foundation.scss +2 -5
  90. data/scss/foundation/_variables.scss +326 -295
  91. data/scss/foundation/components/_alert-boxes.scss +10 -10
  92. data/scss/foundation/components/_block-grid.scss +1 -1
  93. data/scss/foundation/components/_breadcrumbs.scss +8 -8
  94. data/scss/foundation/components/_button-groups.scss +2 -2
  95. data/scss/foundation/components/_buttons.scss +18 -18
  96. data/scss/foundation/components/_custom-forms.scss +20 -14
  97. data/scss/foundation/components/_dropdown-buttons.scss +9 -9
  98. data/scss/foundation/components/_dropdown.scss +4 -4
  99. data/scss/foundation/components/_flex-video.scss +3 -3
  100. data/scss/foundation/components/_forms.scss +54 -24
  101. data/scss/foundation/components/_global.scss +28 -5
  102. data/scss/foundation/components/_grid-5.scss +214 -0
  103. data/scss/foundation/components/_grid.scss +3 -3
  104. data/scss/foundation/components/_inline-lists.scss +3 -3
  105. data/scss/foundation/components/_joyride.scss +6 -6
  106. data/scss/foundation/components/_keystrokes.scss +3 -3
  107. data/scss/foundation/components/_labels.scss +3 -3
  108. data/scss/foundation/components/_orbit.scss +34 -9
  109. data/scss/foundation/components/_pagination.scss +8 -6
  110. data/scss/foundation/components/_panels.scss +3 -3
  111. data/scss/foundation/components/_pricing-tables.scss +10 -10
  112. data/scss/foundation/components/_progress-bars.scss +3 -3
  113. data/scss/foundation/components/_reveal.scss +7 -7
  114. data/scss/foundation/components/_section.scss +252 -214
  115. data/scss/foundation/components/_side-nav.scss +3 -3
  116. data/scss/foundation/components/_split-buttons.scss +7 -7
  117. data/scss/foundation/components/_sub-nav.scss +7 -7
  118. data/scss/foundation/components/_switch.scss +4 -4
  119. data/scss/foundation/components/_tables.scss +6 -6
  120. data/scss/foundation/components/_tooltips.scss +4 -4
  121. data/scss/foundation/components/_top-bar.scss +14 -10
  122. data/scss/foundation/components/_type.scss +23 -23
  123. data/templates/project/index.html +4 -4
  124. data/templates/project/scss/app.scss +8 -0
  125. metadata +29 -4
@@ -113,7 +113,7 @@
113
113
 
114
114
  <h5>Want IE8 Grid Support?</h5>
115
115
  <p>We know it can be hard to get clients to ditch support for IE8. We're hoping with the auto-update to IE10 release from Microsoft, we won't need to worry about it anymore. Until then, here's a gist with a grid that will work in IE8, just like it did in Foundation 3.</p>
116
- <a class="small button" href="https://gist.github.com/zurbchris/5068210">Foundation IE8 Grid</a>
116
+ <a class="small button" href="https://gist.github.com/hatefulcrawdad/5068210">Foundation IE8 Grid</a>
117
117
 
118
118
  <hr>
119
119
 
@@ -0,0 +1,194 @@
1
+ /*jslint unparam: true, browser: true, indent: 2 */
2
+
3
+ ;(function ($, window, document, undefined) {
4
+ 'use strict';
5
+
6
+ Foundation.libs.abide = {
7
+ name : 'abide',
8
+
9
+ version : '4.3.0',
10
+
11
+ settings : {
12
+ live_validate : true,
13
+ focus_on_invalid : true,
14
+ timeout : 1000,
15
+ patterns : {
16
+ alpha: /[a-zA-Z]+/,
17
+ alpha_numeric : /[a-zA-Z0-9]+/,
18
+ integer: /-?\d+/,
19
+ number: /-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?/,
20
+
21
+ // generic password: upper-case, lower-case, number/special character, and min 8 characters
22
+ password : /(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,
23
+
24
+ // amex, visa, diners
25
+ card : /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/,
26
+ cvv : /^([0-9]){3,4}$/,
27
+
28
+ // http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#valid-e-mail-address
29
+ email : /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,
30
+
31
+ url: /(https?|ftp|file|ssh):\/\/(((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?/,
32
+ // abc.de
33
+ domain: /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$/,
34
+
35
+ datetime: /([0-2][0-9]{3})\-([0-1][0-9])\-([0-3][0-9])T([0-5][0-9])\:([0-5][0-9])\:([0-5][0-9])(Z|([\-\+]([0-1][0-9])\:00))/,
36
+ // YYYY-MM-DD
37
+ date: /(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))/,
38
+ // HH:MM:SS
39
+ time : /(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){2}/,
40
+ dateISO: /\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}/,
41
+ // MM/DD/YYYY
42
+ month_day_year : /(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.](19|20)\d\d/,
43
+
44
+ // #FFF or #FFFFFF
45
+ color: /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/
46
+ }
47
+ },
48
+
49
+ timer : null,
50
+
51
+ init : function (scope, method, options) {
52
+ if (typeof method === 'object') {
53
+ $.extend(true, this.settings, method);
54
+ }
55
+
56
+ if (typeof method !== 'string') {
57
+ if (!this.settings.init) { this.events(); }
58
+
59
+ } else {
60
+ return this[method].call(this, options);
61
+ }
62
+ },
63
+
64
+ events : function () {
65
+ var self = this,
66
+ forms = $('form[data-abide]', this.scope).attr('novalidate', 'novalidate');
67
+
68
+ forms
69
+ .on('submit validate', function (e) {
70
+ return self.validate($(this).find('input, textarea, select').get(), e);
71
+ });
72
+
73
+ this.settings.init = true;
74
+
75
+ if (!this.settings.live_validate) return;
76
+
77
+ forms
78
+ .find('input, textarea, select')
79
+ .on('blur change', function (e) {
80
+ self.validate([this], e);
81
+ })
82
+ .on('keydown', function (e) {
83
+ clearTimeout(self.timer);
84
+ self.timer = setTimeout(function () {
85
+ self.validate([this], e);
86
+ }.bind(this), self.settings.timeout);
87
+ });
88
+ },
89
+
90
+ validate : function (els, e) {
91
+ var validations = this.parse_patterns(els),
92
+ validation_count = validations.length,
93
+ form = $(els[0]).closest('form');
94
+
95
+ while (validation_count--) {
96
+ if (!validations[validation_count] && /submit/.test(e.type)) {
97
+ if (this.settings.focus_on_invalid) els[validation_count].focus();
98
+ form.trigger('invalid');
99
+ $(els[validation_count]).closest('form').attr('data-invalid', '');
100
+ return false;
101
+ }
102
+ }
103
+
104
+ if (/submit/.test(e.type)) {
105
+ form.trigger('valid');
106
+ }
107
+
108
+ form.removeAttr('data-invalid');
109
+
110
+ return true;
111
+ },
112
+
113
+ parse_patterns : function (els) {
114
+ var count = els.length,
115
+ el_patterns = [];
116
+
117
+ for (var i = count - 1; i >= 0; i--) {
118
+ el_patterns.push(this.pattern(els[i]));
119
+ }
120
+
121
+ return this.check_validation_and_apply_styles(el_patterns);
122
+ },
123
+
124
+ pattern : function (el) {
125
+ var type = el.getAttribute('type'),
126
+ required = typeof el.getAttribute('required') === 'string';
127
+
128
+ if (this.settings.patterns.hasOwnProperty(type)) {
129
+ return [el, this.settings.patterns[type], required];
130
+ }
131
+
132
+ var pattern = el.getAttribute('pattern') || '';
133
+
134
+ if (this.settings.patterns.hasOwnProperty(pattern) && pattern.length > 0) {
135
+ return [el, this.settings.patterns[pattern], required];
136
+ } else if (pattern.length > 0) {
137
+ return [el, new RegExp(pattern), required];
138
+ }
139
+
140
+ pattern = /.*/;
141
+
142
+ return [el, pattern, required];
143
+ },
144
+
145
+ check_validation_and_apply_styles : function (el_patterns) {
146
+ var count = el_patterns.length,
147
+ validations = [];
148
+
149
+ for (var i = count - 1; i >= 0; i--) {
150
+ var el = el_patterns[i][0],
151
+ required = el_patterns[i][2],
152
+ value = el.value,
153
+ is_radio = el.type === "radio",
154
+ valid_length = (required) ? (el.value.length > 0) : true;
155
+
156
+ if (is_radio && required) {
157
+ validations.push(this.valid_radio(el, required));
158
+ } else {
159
+ if (el_patterns[i][1].test(value) && valid_length ||
160
+ !required && el.value.length < 1) {
161
+ $(el).removeAttr('data-invalid').parent().removeClass('error');
162
+ validations.push(true);
163
+ } else {
164
+ $(el).attr('data-invalid', '').parent().addClass('error');
165
+ validations.push(false);
166
+ }
167
+ }
168
+ }
169
+
170
+ return validations;
171
+ },
172
+
173
+ valid_radio : function (el, required) {
174
+ var name = el.getAttribute('name'),
175
+ group = document.getElementsByName(name),
176
+ count = group.length,
177
+ valid = false;
178
+
179
+ for (var i=0; i < count; i++) {
180
+ if (group[i].checked) valid = true;
181
+ }
182
+
183
+ for (var i=0; i < count; i++) {
184
+ if (valid) {
185
+ $(group[i]).removeAttr('data-invalid').parent().removeClass('error');
186
+ } else {
187
+ $(group[i]).attr('data-invalid', '').parent().addClass('error');
188
+ }
189
+ }
190
+
191
+ return valid;
192
+ }
193
+ };
194
+ }(Foundation.zj, this, this.document));
@@ -6,7 +6,7 @@
6
6
  Foundation.libs.dropdown = {
7
7
  name : 'dropdown',
8
8
 
9
- version : '4.2.0',
9
+ version : '4.3.0',
10
10
 
11
11
  settings : {
12
12
  activeClass: 'open',
@@ -57,7 +57,7 @@
57
57
  .on('opened.fndtn.dropdown', '[data-dropdown-content]', this.settings.opened)
58
58
  .on('closed.fndtn.dropdown', '[data-dropdown-content]', this.settings.closed);
59
59
 
60
- $('body').on('click.fndtn.dropdown', function (e) {
60
+ $(document).on('click.fndtn.dropdown', function (e) {
61
61
  var parent = $(e.target).closest('[data-dropdown-content]');
62
62
 
63
63
  if ($(e.target).data('dropdown')) {
@@ -121,14 +121,13 @@
121
121
 
122
122
  css : function (dropdown, target) {
123
123
  var offset_parent = dropdown.offsetParent();
124
- // temporary workaround until 4.2
125
- if (offset_parent.length > 0 && /body/i.test(dropdown.offsetParent()[0].nodeName)) {
124
+ // if (offset_parent.length > 0 && /body/i.test(dropdown.offsetParent()[0].nodeName)) {
126
125
  var position = target.offset();
127
- position.top -= dropdown.offsetParent().offset().top;
128
- position.left -= dropdown.offsetParent().offset().left;
129
- } else {
130
- var position = target.position();
131
- }
126
+ position.top -= offset_parent.offset().top;
127
+ position.left -= offset_parent.offset().left;
128
+ // } else {
129
+ // var position = target.position();
130
+ // }
132
131
 
133
132
  if (this.small()) {
134
133
  dropdown.css({
@@ -2,9 +2,9 @@
2
2
  'use strict';
3
3
 
4
4
  Foundation.libs.forms = {
5
- name: 'forms',
5
+ name : 'forms',
6
6
 
7
- version: '4.2.3',
7
+ version: '4.3.1',
8
8
 
9
9
  cache: {},
10
10
 
@@ -150,7 +150,15 @@
150
150
 
151
151
  //store the old value in data
152
152
  $select.data('prevalue', $oldThis.html());
153
- $select.trigger('change');
153
+
154
+ // Kick off full DOM change event
155
+ if (typeof (document.createEvent) != 'undefined') {
156
+ var event = document.createEvent('HTMLEvents');
157
+ event.initEvent('change', true, true);
158
+ $select[0].dispatchEvent(event);
159
+ } else {
160
+ $select[0].fireEvent('onchange'); // for IE
161
+ }
154
162
  }
155
163
  });
156
164
 
@@ -6,10 +6,12 @@
6
6
  Foundation.libs.interchange = {
7
7
  name : 'interchange',
8
8
 
9
- version : '4.2.2',
9
+ version : '4.2.4',
10
10
 
11
11
  cache : {},
12
12
 
13
+ images_loaded : false,
14
+
13
15
  settings : {
14
16
  load_attr : 'interchange',
15
17
 
@@ -29,13 +31,11 @@
29
31
  },
30
32
 
31
33
  directives : {
32
- replace : function (el, path) {
34
+ replace: function (el, path) {
33
35
  if (/IMG/.test(el[0].nodeName)) {
34
- var path_parts = path.split('/'),
35
- path_file = path_parts[path_parts.length - 1],
36
- orig_path = el[0].src;
36
+ var orig_path = el[0].src;
37
37
 
38
- if (new RegExp(path_file, 'i').test(el[0].src)) return;
38
+ if (new RegExp(path, 'i').test(orig_path)) return;
39
39
 
40
40
  el[0].src = path;
41
41
 
@@ -73,6 +73,11 @@
73
73
  resize : function () {
74
74
  var cache = this.cache;
75
75
 
76
+ if(!this.images_loaded) {
77
+ setTimeout($.proxy(this.resize, this), 50);
78
+ return;
79
+ }
80
+
76
81
  for (var uuid in cache) {
77
82
  if (cache.hasOwnProperty(uuid)) {
78
83
  var passed = this.results(uuid, cache[uuid]);
@@ -87,18 +92,17 @@
87
92
  },
88
93
 
89
94
  results : function (uuid, scenarios) {
90
- var count = scenarios.length,
91
- results_arr = [];
95
+ var count = scenarios.length;
92
96
 
93
97
  if (count > 0) {
94
98
  var el = $('[data-uuid="' + uuid + '"]');
95
99
 
96
100
  for (var i = count - 1; i >= 0; i--) {
97
- var rule = scenarios[i][2];
101
+ var mq, rule = scenarios[i][2];
98
102
  if (this.settings.named_queries.hasOwnProperty(rule)) {
99
- var mq = matchMedia(this.settings.named_queries[rule]);
103
+ mq = matchMedia(this.settings.named_queries[rule]);
100
104
  } else {
101
- var mq = matchMedia(scenarios[i][2]);
105
+ mq = matchMedia(rule);
102
106
  }
103
107
  if (mq.matches) {
104
108
  return {el: el, scenario: scenarios[i]};
@@ -120,12 +124,15 @@
120
124
  update_images : function () {
121
125
  var images = document.getElementsByTagName('img'),
122
126
  count = images.length,
127
+ loaded_count = 0,
123
128
  data_attr = 'data-' + this.settings.load_attr;
124
129
 
125
130
  this.cached_images = [];
131
+ this.images_loaded = false;
126
132
 
127
133
  for (var i = count - 1; i >= 0; i--) {
128
- this.loaded($(images[i]), (i === 0), function (image, last) {
134
+ this.loaded($(images[i]), function (image) {
135
+ loaded_count++;
129
136
  if (image) {
130
137
  var str = image.getAttribute(data_attr) || '';
131
138
 
@@ -134,8 +141,10 @@
134
141
  }
135
142
  }
136
143
 
137
- if (last) this.enhance();
138
-
144
+ if(loaded_count === count) {
145
+ this.images_loaded = true;
146
+ this.enhance();
147
+ }
139
148
  }.bind(this));
140
149
  }
141
150
 
@@ -145,9 +154,9 @@
145
154
  // based on jquery.imageready.js
146
155
  // @weblinc, @jsantell, (c) 2012
147
156
 
148
- loaded : function (image, last, callback) {
157
+ loaded : function (image, callback) {
149
158
  function loaded () {
150
- callback(image[0], last);
159
+ callback(image[0]);
151
160
  }
152
161
 
153
162
  function bindLoad () {
@@ -4,7 +4,7 @@
4
4
  'use strict';
5
5
 
6
6
  Foundation.libs.joyride = {
7
- name: 'joyride',
7
+ name : 'joyride',
8
8
 
9
9
  version : '4.2.2',
10
10
 
@@ -42,7 +42,7 @@
42
42
  expose : '<div class="joyride-expose-wrapper"></div>',
43
43
  exposeCover: '<div class="joyride-expose-cover"></div>'
44
44
  },
45
- exposeAddClass : '' // One or more space-separated class names to be added to exposed element
45
+ exposeAddClass : '' // One or more space-separated class names to be added to exposed element
46
46
  },
47
47
 
48
48
  settings : {},
@@ -350,7 +350,13 @@
350
350
  if (!this.settings.modal) {
351
351
  $('.joyride-modal-bg').hide();
352
352
  }
353
- this.settings.$current_tip.hide();
353
+
354
+ // Prevent scroll bouncing...wait to remove from layout
355
+ this.settings.$current_tip.css('visibility', 'hidden');
356
+ setTimeout($.proxy(function() {
357
+ this.hide();
358
+ this.css('visibility', 'visible');
359
+ }, this.settings.$current_tip), 0);
354
360
  this.settings.postStepCallback(this.settings.$li.index(),
355
361
  this.settings.$current_tip);
356
362
  },
@@ -166,7 +166,7 @@ if (typeof jQuery === "undefined" &&
166
166
  window.Foundation = {
167
167
  name : 'Foundation',
168
168
 
169
- version : '4.2.3',
169
+ version : '4.3.0',
170
170
 
171
171
  cache : {},
172
172
 
@@ -231,8 +231,7 @@ if (typeof jQuery === "undefined" &&
231
231
  if (this.libs.hasOwnProperty(lib)) {
232
232
  this.patch(this.libs[lib]);
233
233
  return this.libs[lib].init.apply(this.libs[lib], args);
234
- }
235
- else {
234
+ } else {
236
235
  return function () {};
237
236
  }
238
237
  }.bind(this), lib);
@@ -9,7 +9,8 @@
9
9
  version : '4.2.2',
10
10
 
11
11
  settings : {
12
- activeClass: 'active'
12
+ activeClass: 'active',
13
+ threshold: 0
13
14
  },
14
15
 
15
16
  init : function (scope, method, options) {
@@ -131,4 +132,4 @@
131
132
 
132
133
  reflow : function () {}
133
134
  };
134
- }(Foundation.zj, this, this.document));
135
+ }(Foundation.zj, this, this.document));
@@ -1,390 +1,405 @@
1
1
  ;(function ($, window, document, undefined) {
2
2
  'use strict';
3
3
 
4
- Foundation.libs = Foundation.libs || {};
5
-
6
- Foundation.libs.orbit = {
7
- name: 'orbit',
8
-
9
- version: '4.2.0',
4
+ var noop = function() {};
5
+
6
+ var Orbit = function(el, settings) {
7
+ var self = this,
8
+ container,
9
+ slides_container = el,
10
+ number_container,
11
+ bullets_container,
12
+ timer_container,
13
+ idx = 0,
14
+ animate,
15
+ timer,
16
+ locked = false,
17
+ adjust_height_after = false;
18
+
19
+ slides_container.children().first().addClass(settings.active_slide_class);
20
+
21
+ self.update_slide_number = function(index) {
22
+ if (settings.slide_number) {
23
+ number_container.find('span:first').text(parseInt(index)+1);
24
+ number_container.find('span:last').text(slides_container.children().length);
25
+ }
26
+ if (settings.bullets) {
27
+ bullets_container.children().removeClass(settings.bullets_active_class);
28
+ $(bullets_container.children().get(index)).addClass(settings.bullets_active_class);
29
+ }
30
+ };
10
31
 
11
- settings: {
12
- timer_speed: 10000,
13
- pause_on_hover: true,
14
- resume_on_mouseout: false,
15
- animation_speed: 500,
16
- bullets: true,
17
- stack_on_small: true,
18
- navigation_arrows: true,
19
- slide_number: true,
20
- container_class: 'orbit-container',
21
- stack_on_small_class: 'orbit-stack-on-small',
22
- next_class: 'orbit-next',
23
- prev_class: 'orbit-prev',
24
- timer_container_class: 'orbit-timer',
25
- timer_paused_class: 'paused',
26
- timer_progress_class: 'orbit-progress',
27
- slides_container_class: 'orbit-slides-container',
28
- bullets_container_class: 'orbit-bullets',
29
- bullets_active_class: 'active',
30
- slide_number_class: 'orbit-slide-number',
31
- caption_class: 'orbit-caption',
32
- active_slide_class: 'active',
33
- orbit_transition_class: 'orbit-transitioning'
34
- },
32
+ self.build_markup = function() {
33
+ slides_container.wrap('<div class="'+settings.container_class+'"></div>');
34
+ container = slides_container.parent();
35
+ slides_container.addClass(settings.slides_container_class);
36
+
37
+ if (settings.navigation_arrows) {
38
+ container.append($('<a>').addClass(settings.prev_class).append('<span>'));
39
+ container.append($('<a>').addClass(settings.next_class).append('<span>'));
40
+ }
35
41
 
36
- init: function (scope, method, options) {
37
- var self = this;
38
- Foundation.inherit(self, 'data_options');
42
+ if (settings.timer) {
43
+ timer_container = $('<div>').addClass(settings.timer_container_class);
44
+ timer_container.append('<span>');
45
+ timer_container.append($('<div>').addClass(settings.timer_progress_class));
46
+ timer_container.addClass(settings.timer_paused_class);
47
+ container.append(timer_container);
48
+ }
39
49
 
40
- if (typeof method === 'object') {
41
- $.extend(true, self.settings, method);
50
+ if (settings.slide_number) {
51
+ number_container = $('<div>').addClass(settings.slide_number_class);
52
+ number_container.append('<span></span> of <span></span>');
53
+ container.append(number_container);
42
54
  }
43
55
 
44
- if ($(scope).is('[data-orbit]')) {
45
- var scoped_self = $.extend(true, {}, self);
46
- scoped_self._init(idx, el);
56
+ if (settings.bullets) {
57
+ bullets_container = $('<ol>').addClass(settings.bullets_container_class);
58
+ container.append(bullets_container);
59
+ slides_container.children().each(function(idx, el) {
60
+ var bullet = $('<li>').attr('data-orbit-slide', idx);
61
+ bullets_container.append(bullet);
62
+ });
47
63
  }
48
64
 
49
- $('[data-orbit]', scope).each(function(idx, el) {
50
- var scoped_self = $.extend(true, {}, self);
51
- scoped_self._init(idx, el);
52
- });
53
- },
65
+ if (settings.stack_on_small) {
66
+ container.addClass(settings.stack_on_small_class);
67
+ }
54
68
 
55
- _container_html: function() {
56
- var self = this;
57
- return '<div class="' + self.settings.container_class + '"></div>';
58
- },
69
+ self.update_slide_number(0);
70
+ };
59
71
 
60
- _bullets_container_html: function($slides) {
61
- var self = this,
62
- $list = $('<ol class="' + self.settings.bullets_container_class + '"></ol>');
63
- $slides.each(function(idx, slide) {
64
- var $item = $('<li data-orbit-slide-number="' + (idx+1) + '" class=""></li>');
65
- if (idx === 0) {
66
- $item.addClass(self.settings.bullets_active_class);
67
- }
68
- $list.append($item);
69
- });
70
- return $list;
71
- },
72
+ self._goto = function(next_idx, start_timer) {
73
+ // if (locked) {return false;}
74
+ if (next_idx === idx) {return false;}
75
+ if (typeof timer === 'object') {timer.restart();}
76
+ var slides = slides_container.children();
72
77
 
73
- _slide_number_html: function(slide_number, total_slides) {
74
- var self = this,
75
- $container = $('<div class="' + self.settings.slide_number_class + '"></div>');
76
- $container.append('<span>' + slide_number + '</span> of <span>' + total_slides + '</span>');
77
- return $container;
78
- },
78
+ var dir = 'next';
79
+ locked = true;
80
+ if (next_idx < idx) {dir = 'prev';}
81
+ if (next_idx >= slides.length) {next_idx = 0;}
82
+ else if (next_idx < 0) {next_idx = slides.length - 1;}
83
+
84
+ var current = $(slides.get(idx));
85
+ var next = $(slides.get(next_idx));
79
86
 
80
- _timer_html: function() {
81
- var self = this;
82
- if (typeof self.settings.timer_speed === 'number' && self.settings.timer_speed > 0) {
83
- return '<div class="' + self.settings.timer_container_class
84
- + '"><span></span><div class="' + self.settings.timer_progress_class
85
- + '"></div></div>';
86
- } else {
87
- return '';
88
- }
89
- },
87
+ current.css('zIndex', 2);
88
+ next.css('zIndex', 4).addClass('active');
90
89
 
91
- _next_html: function() {
92
- var self = this;
93
- return '<a href="#" class="' + self.settings.next_class + '">Next <span></span></a>';
94
- },
90
+ slides_container.trigger('orbit:before-slide-change');
91
+ settings.before_slide_change();
92
+
93
+ var callback = function() {
94
+ var unlock = function() {
95
+ idx = next_idx;
96
+ locked = false;
97
+ if (start_timer === true) {timer = self.create_timer(); timer.start();}
98
+ self.update_slide_number(idx);
99
+ slides_container.trigger('orbit:after-slide-change',[{slide_number: idx, total_slides: slides.length}]);
100
+ settings.after_slide_change(idx, slides.length);
101
+ };
102
+ if (slides_container.height() != next.height()) {
103
+ slides_container.animate({'height': next.height()}, 250, 'linear', unlock);
104
+ } else {
105
+ unlock();
106
+ }
107
+ };
95
108
 
96
- _prev_html: function() {
97
- var self = this;
98
- return '<a href="#" class="' + self.settings.prev_class + '">Prev <span></span></a>';
99
- },
109
+ if (slides.length === 1) {callback(); return false;}
100
110
 
101
- _init: function (idx, slider) {
102
- var self = this,
103
- $slides_container = $(slider),
104
- $container = $slides_container.wrap(self._container_html()).parent(),
105
- $slides = $slides_container.children();
106
-
107
- $.extend(true, self.settings, self.data_options($slides_container));
111
+ var start_animation = function() {
112
+ if (dir === 'next') {animate.next(current, next, callback);}
113
+ if (dir === 'prev') {animate.prev(current, next, callback);}
114
+ };
108
115
 
109
- if (self.settings.navigation_arrows) {
110
- $container.append(self._prev_html());
111
- $container.append(self._next_html());
112
- }
113
- $slides_container.addClass(self.settings.slides_container_class);
114
- if (self.settings.stack_on_small) {
115
- $container.addClass(self.settings.stack_on_small_class);
116
+ if (next.height() > slides_container.height()) {
117
+ slides_container.animate({'height': next.height()}, 250, 'linear', start_animation);
118
+ } else {
119
+ start_animation();
116
120
  }
117
- if (self.settings.slide_number) {
118
- $container.append(self._slide_number_html(1, $slides.length));
121
+ };
122
+
123
+ self.next = function(e) {
124
+ e.stopImmediatePropagation();
125
+ e.preventDefault();
126
+ self._goto(idx + 1);
127
+ };
128
+
129
+ self.prev = function(e) {
130
+ e.stopImmediatePropagation();
131
+ e.preventDefault();
132
+ self._goto(idx - 1);
133
+ };
134
+
135
+ self.link_custom = function(e) {
136
+ e.preventDefault();
137
+ var link = $(this).attr('data-orbit-link');
138
+ if ((typeof link === 'string') && (link = $.trim(link)) != "") {
139
+ var slide = container.find('[data-orbit-slide='+link+']');
140
+ if (slide.index() != -1) {self._goto(slide.index());}
119
141
  }
120
- $container.append(self._timer_html());
121
- if (self.settings.bullets) {
122
- $container.after(self._bullets_container_html($slides));
142
+ };
143
+
144
+ self.link_bullet = function(e) {
145
+ var index = $(this).attr('data-orbit-slide');
146
+ if ((typeof index === 'string') && (index = $.trim(index)) != "") {
147
+ self._goto(index);
123
148
  }
124
- // To better support the "sliding" effect it's easier
125
- // if we just clone the first and last slides
126
- $slides_container.append($slides.first().clone().attr('data-orbit-slide',''));
127
- $slides_container.prepend($slides.last().clone().attr('data-orbit-slide',''));
128
- // Make the first "real" slide active
129
- $slides_container.css(Foundation.rtl ? 'marginRight' : 'marginLeft', '-100%');
130
- $slides.first().addClass(self.settings.active_slide_class);
131
-
132
- self._init_events($slides_container);
133
- self._init_dimensions($slides_container);
134
- self._start_timer($slides_container);
135
- },
149
+ }
136
150
 
137
- _init_events: function ($slides_container) {
138
- var self = this,
139
- $container = $slides_container.parent();
140
-
141
- $(window)
142
- .on('load.fndtn.orbit', function() {
143
- $slides_container.height('');
144
- $slides_container.height($slides_container.height($container.height()));
145
- $slides_container.trigger('orbit:ready');
146
- })
147
- .on('resize.fndtn.orbit', function() {
148
- $slides_container.height('');
149
- $slides_container.height($slides_container.height($container.height()));
151
+ self.timer_callback = function() {
152
+ self._goto(idx + 1, true);
153
+ }
154
+
155
+ self.compute_dimensions = function() {
156
+ var current = $(slides_container.children().get(idx));
157
+ var h = current.height();
158
+ if (!settings.variable_height) {
159
+ slides_container.children().each(function(){
160
+ if ($(this).height() > h) { h = $(this).height(); }
150
161
  });
162
+ }
163
+ slides_container.height(h);
164
+ };
165
+
166
+ self.create_timer = function() {
167
+ var t = new Timer(
168
+ container.find('.'+settings.timer_container_class),
169
+ settings,
170
+ self.timer_callback
171
+ );
172
+ return t;
173
+ };
174
+
175
+ self.stop_timer = function() {
176
+ if (typeof timer === 'object') timer.stop();
177
+ };
178
+
179
+ self.toggle_timer = function() {
180
+ var t = container.find('.'+settings.timer_container_class);
181
+ if (t.hasClass(settings.timer_paused_class)) {
182
+ if (typeof timer === 'undefined') {timer = self.create_timer();}
183
+ timer.start();
184
+ }
185
+ else {
186
+ if (typeof timer === 'object') {timer.stop();}
187
+ }
188
+ };
189
+
190
+ self.init = function() {
191
+ self.build_markup();
192
+ if (settings.timer) {timer = self.create_timer(); timer.start();}
193
+ animate = new FadeAnimation(slides_container);
194
+ if (settings.animation === 'slide')
195
+ animate = new SlideAnimation(slides_container);
196
+ container.on('click', '.'+settings.next_class, self.next);
197
+ container.on('click', '.'+settings.prev_class, self.prev);
198
+ container.on('click', self.toggle_timer);
199
+ container.on('touchstart.fndtn.orbit', function(e) {
200
+ if (!e.touches) {e = e.originalEvent;}
201
+ var data = {
202
+ start_page_x: e.touches[0].pageX,
203
+ start_page_y: e.touches[0].pageY,
204
+ start_time: (new Date()).getTime(),
205
+ delta_x: 0,
206
+ is_scrolling: undefined
207
+ };
208
+ container.data('swipe-transition', data);
209
+ e.stopPropagation();
210
+ })
211
+ .on('touchmove.fndtn.orbit', function(e) {
212
+ if (!e.touches) { e = e.originalEvent; }
213
+ // Ignore pinch/zoom events
214
+ if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
215
+
216
+ var data = container.data('swipe-transition');
217
+ if (typeof data === 'undefined') {data = {};}
218
+
219
+ data.delta_x = e.touches[0].pageX - data.start_page_x;
220
+
221
+ if ( typeof data.is_scrolling === 'undefined') {
222
+ data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
223
+ }
151
224
 
152
- $(document).on('click.fndtn.orbit', '[data-orbit-link]', function(e) {
153
- e.preventDefault();
154
- var id = $(e.currentTarget).attr('data-orbit-link'),
155
- $slide = $slides_container.find('[data-orbit-slide=' + id + ']').first();
156
-
157
- if ($slide.length === 1) {
158
- self._reset_timer($slides_container, true);
159
- self._goto($slides_container, $slide.index(), function() {});
225
+ if (!data.is_scrolling && !data.active) {
226
+ e.preventDefault();
227
+ var direction = (data.delta_x < 0) ? (idx+1) : (idx-1);
228
+ data.active = true;
229
+ self._goto(direction);
230
+ }
231
+ })
232
+ .on('touchend.fndtn.orbit', function(e) {
233
+ container.data('swipe-transition', {});
234
+ e.stopPropagation();
235
+ })
236
+ .on('mouseenter.fndtn.orbit', function(e) {
237
+ if (settings.timer && settings.pause_on_hover) {
238
+ self.stop_timer();
239
+ }
240
+ })
241
+ .on('mouseleave.fndtn.orbit', function(e) {
242
+ if (settings.timer && settings.resume_on_mouseout) {
243
+ timer.start();
160
244
  }
161
245
  });
246
+
247
+ $(document).on('click', '[data-orbit-link]', self.link_custom);
248
+ $(document).on('click', '[data-orbit-slide]', self.link_bullet)
249
+ $(window).on('resize', self.compute_dimensions);
250
+ $(window).on('load', self.compute_dimensions);
251
+ slides_container.trigger('orbit:ready');
252
+ };
253
+
254
+ self.init();
255
+ };
162
256
 
163
- $container.siblings('.' + self.settings.bullets_container_class)
164
- .on('click.fndtn.orbit', '[data-orbit-slide-number]', function(e) {
165
- e.preventDefault();
166
- self._reset_timer($slides_container, true);
167
- self._goto($slides_container, $(e.currentTarget).data('orbit-slide-number'),function() {});
168
- });
257
+ var Timer = function(el, settings, callback) {
258
+ var self = this,
259
+ duration = settings.timer_speed,
260
+ progress = el.find('.'+settings.timer_progress_class),
261
+ start,
262
+ timeout,
263
+ left = -1;
264
+
265
+ this.update_progress = function(w) {
266
+ var new_progress = progress.clone();
267
+ new_progress.attr('style', '');
268
+ new_progress.css('width', w+'%');
269
+ progress.replaceWith(new_progress);
270
+ progress = new_progress;
271
+ };
272
+
273
+ this.restart = function() {
274
+ clearTimeout(timeout);
275
+ el.addClass(settings.timer_paused_class);
276
+ left = -1;
277
+ self.update_progress(0);
278
+ };
279
+
280
+ this.start = function() {
281
+ if (!el.hasClass(settings.timer_paused_class)) {return true;}
282
+ left = (left === -1) ? duration : left;
283
+ el.removeClass(settings.timer_paused_class);
284
+ start = new Date().getTime();
285
+ progress.animate({'width': '100%'}, left, 'linear');
286
+ timeout = setTimeout(function() {
287
+ self.restart();
288
+ callback();
289
+ }, left);
290
+ el.trigger('orbit:timer-started')
291
+ };
292
+
293
+ this.stop = function() {
294
+ if (el.hasClass(settings.timer_paused_class)) {return true;}
295
+ clearTimeout(timeout);
296
+ el.addClass(settings.timer_paused_class);
297
+ var end = new Date().getTime();
298
+ left = left - (end - start);
299
+ var w = 100 - ((left / duration) * 100);
300
+ self.update_progress(w);
301
+ el.trigger('orbit:timer-stopped');
302
+ };
303
+ };
304
+
305
+ var SlideAnimation = function(container) {
306
+ var duration = 400;
169
307
 
170
- $container
171
- .on('mouseenter.fndtn.orbit', function(e) {
172
- if (self.settings.pause_on_hover) {
173
- self._stop_timer($slides_container);
174
- }
175
- })
176
- .on('mouseleave.fndtn.orbit', function(e) {
177
- if (self.settings.resume_on_mouseout) {
178
- self._start_timer($slides_container);
179
- }
180
- })
181
- .on('orbit:after-slide-change.fndtn.orbit', function(e, orbit) {
182
- var $slide_number = $container.find('.' + self.settings.slide_number_class);
183
-
184
- if ($slide_number.length === 1) {
185
- $slide_number.replaceWith(self._slide_number_html(orbit.slide_number, orbit.total_slides));
186
- }
187
- })
188
- .on('orbit:next-slide.fndtn.orbit click.fndtn.orbit', '.' + self.settings.next_class.split(" ").join("."), function(e) {
189
- e.preventDefault();
190
- self._reset_timer($slides_container, true);
191
- self._goto($slides_container, 'next', function() {});
192
- })
193
- .on('orbit:prev-slide.fndtn.orbit click.fndtn.orbit', '.' + self.settings.prev_class.split(" ").join("."), function(e) {
194
- e.preventDefault();
195
- self._reset_timer($slides_container, true);
196
- self._goto($slides_container, 'prev', function() {});
197
- })
198
- .on('orbit:toggle-play-pause.fndtn.orbit click.fndtn.orbit touchstart.fndtn.orbit', '.' + self.settings.timer_container_class, function(e) {
199
- e.preventDefault();
200
- var $timer = $(e.currentTarget).toggleClass(self.settings.timer_paused_class),
201
- $slides_container = $timer.closest('.' + self.settings.container_class)
202
- .find('.' + self.settings.slides_container_class);
203
-
204
- if ($timer.hasClass(self.settings.timer_paused_class)) {
205
- self._stop_timer($slides_container);
206
- } else {
207
- self._start_timer($slides_container);
208
- }
209
- })
210
- .on('touchstart.fndtn.orbit', function(e) {
211
- if (!e.touches) { e = e.originalEvent; }
212
- var data = {
213
- start_page_x: e.touches[0].pageX,
214
- start_page_y: e.touches[0].pageY,
215
- start_time: (new Date()).getTime(),
216
- delta_x: 0,
217
- is_scrolling: undefined
218
- };
219
- $container.data('swipe-transition', data);
220
- e.stopPropagation();
221
- })
222
- .on('touchmove.fndtn.orbit', function(e) {
223
- if (!e.touches) { e = e.originalEvent; }
224
- // Ignore pinch/zoom events
225
- if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
226
-
227
- var data = $container.data('swipe-transition');
228
- if (typeof data === 'undefined') {
229
- data = {};
230
- }
231
-
232
- data.delta_x = e.touches[0].pageX - data.start_page_x;
233
-
234
- if ( typeof data.is_scrolling === 'undefined') {
235
- data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
236
- }
237
-
238
- if (!data.is_scrolling && !data.active) {
239
- e.preventDefault();
240
- self._stop_timer($slides_container);
241
- var direction = (data.delta_x < 0) ? 'next' : 'prev';
242
- data.active = true;
243
- self._goto($slides_container, direction, function() {});
244
- }
245
- })
246
- .on('touchend.fndtn.orbit', function(e) {
247
- $container.data('swipe-transition', {});
248
- e.stopPropagation();
249
- });
250
- },
308
+ this.next = function(current, next, callback) {
309
+ next.animate({'marginLeft': '0%'}, duration, 'linear', function() {
310
+ current.css('marginLeft', '100%');
311
+ callback();
312
+ });
313
+ };
251
314
 
252
- _init_dimensions: function ($slides_container) {
253
- var $container = $slides_container.parent(),
254
- $slides = $slides_container.children();
315
+ this.prev = function(current, prev, callback) {
316
+ prev.css('marginLeft', '-100%');
317
+ prev.animate({'marginLeft':'0%'}, duration, 'linear', function() {
318
+ current.css('marginLeft', '100%');
319
+ callback();
320
+ });
321
+ };
322
+ };
255
323
 
256
- $slides_container.css('width', $slides.length * 100 + '%');
257
- $slides.css('width', 100 / $slides.length + '%');
258
- $slides_container.height($container.height());
259
- $slides_container.css('width', $slides.length * 100 + '%');
260
- },
324
+ var FadeAnimation = function(container) {
325
+ var duration = 250;
261
326
 
262
- _start_timer: function ($slides_container) {
263
- var self = this,
264
- $container = $slides_container.parent();
327
+ this.next = function(current, next, callback) {
328
+ next.css({'marginLeft':'0%', 'opacity':'0.01'});
329
+ next.animate({'opacity':'1'}, duration, 'linear', function() {
330
+ current.css('marginLeft', '100%');
331
+ callback();
332
+ });
333
+ };
265
334
 
266
- var callback = function() {
267
- self._reset_timer($slides_container, false);
268
- self._goto($slides_container, 'next', function() {
269
- self._start_timer($slides_container);
270
- });
271
- };
335
+ this.prev = function(current, prev, callback) {
336
+ prev.css({'marginLeft':'0%', 'opacity':'0.01'});
337
+ prev.animate({'opacity':'1'}, duration, 'linear', function() {
338
+ current.css('marginLeft', '100%');
339
+ callback();
340
+ });
341
+ };
342
+ };
272
343
 
273
- var $timer = $container.find('.' + self.settings.timer_container_class),
274
- $progress = $timer.find('.' + self.settings.timer_progress_class),
275
- progress_pct = ($progress.width() / $timer.width()),
276
- delay = self.settings.timer_speed - (progress_pct * self.settings.timer_speed);
277
344
 
278
- $progress.animate({'width': '100%'}, delay, 'linear', callback);
279
- $slides_container.trigger('orbit:timer-started');
280
- },
345
+ Foundation.libs = Foundation.libs || {};
281
346
 
282
- _stop_timer: function ($slides_container) {
283
- var self = this,
284
- $container = $slides_container.parent(),
285
- $timer = $container.find('.' + self.settings.timer_container_class),
286
- $progress = $timer.find('.' + self.settings.timer_progress_class),
287
- progress_pct = $progress.width() / $timer.width();
288
- self._rebuild_timer($container, progress_pct * 100 + '%');
289
- // $progress.stop();
290
- $slides_container.trigger('orbit:timer-stopped');
291
- $timer = $container.find('.' + self.settings.timer_container_class);
292
- $timer.addClass(self.settings.timer_paused_class);
293
- },
347
+ Foundation.libs.orbit = {
348
+ name: 'orbit',
294
349
 
295
- _reset_timer: function($slides_container, is_paused) {
296
- var self = this,
297
- $container = $slides_container.parent();
298
- self._rebuild_timer($container, '0%');
299
- if (typeof is_paused === 'boolean' && is_paused) {
300
- var $timer = $container.find('.' + self.settings.timer_container_class);
301
- $timer.addClass(self.settings.timer_paused_class);
302
- }
303
- },
350
+ version: '4.3.0',
304
351
 
305
- _rebuild_timer: function ($container, width_pct) {
306
- // Zepto is unable to stop animations since they
307
- // are css-based. This is a workaround for that
308
- // limitation, which rebuilds the dom element
309
- // thus stopping the animation
310
- var self = this,
311
- $timer = $container.find('.' + self.settings.timer_container_class),
312
- $new_timer = $(self._timer_html()),
313
- $new_timer_progress = $new_timer.find('.' + self.settings.timer_progress_class);
314
-
315
- if (typeof Zepto === 'function') {
316
- $timer.remove();
317
- $container.append($new_timer);
318
- $new_timer_progress.css('width', width_pct);
319
- } else if (typeof jQuery === 'function') {
320
- var $progress = $timer.find('.' + self.settings.timer_progress_class);
321
- $progress.css('width', width_pct);
322
- $progress.stop();
323
- }
352
+ settings: {
353
+ animation: 'slide',
354
+ timer_speed: 10000,
355
+ pause_on_hover: true,
356
+ resume_on_mouseout: false,
357
+ animation_speed: 500,
358
+ stack_on_small: false,
359
+ navigation_arrows: true,
360
+ slide_number: true,
361
+ container_class: 'orbit-container',
362
+ stack_on_small_class: 'orbit-stack-on-small',
363
+ next_class: 'orbit-next',
364
+ prev_class: 'orbit-prev',
365
+ timer_container_class: 'orbit-timer',
366
+ timer_paused_class: 'paused',
367
+ timer_progress_class: 'orbit-progress',
368
+ slides_container_class: 'orbit-slides-container',
369
+ bullets_container_class: 'orbit-bullets',
370
+ bullets_active_class: 'active',
371
+ slide_number_class: 'orbit-slide-number',
372
+ caption_class: 'orbit-caption',
373
+ active_slide_class: 'active',
374
+ orbit_transition_class: 'orbit-transitioning',
375
+ bullets: true,
376
+ timer: true,
377
+ variable_height: false,
378
+ before_slide_change: noop,
379
+ after_slide_change: noop
324
380
  },
325
381
 
326
- _goto: function($slides_container, index_or_direction, callback) {
327
- var self = this,
328
- $container = $slides_container.parent(),
329
- $slides = $slides_container.children(),
330
- $active_slide = $slides_container.find('.' + self.settings.active_slide_class),
331
- active_index = $active_slide.index(),
332
- margin_position = Foundation.rtl ? 'marginRight' : 'marginLeft';
382
+ init: function (scope, method, options) {
383
+ var self = this;
384
+ Foundation.inherit(self, 'data_options');
333
385
 
334
- if ($container.hasClass(self.settings.orbit_transition_class)) {
335
- return false;
386
+ if (typeof method === 'object') {
387
+ $.extend(true, self.settings, method);
336
388
  }
337
389
 
338
- if (index_or_direction === 'prev') {
339
- if (active_index === 0) {
340
- active_index = $slides.length - 1;
341
- }
342
- else {
343
- active_index--;
344
- }
345
- }
346
- else if (index_or_direction === 'next') {
347
- active_index = (active_index+1) % $slides.length;
348
- }
349
- else if (typeof index_or_direction === 'number') {
350
- active_index = (index_or_direction % $slides.length);
351
- }
352
- if (active_index === ($slides.length - 1) && index_or_direction === 'next') {
353
- $slides_container.css(margin_position, '0%');
354
- active_index = 1;
355
- }
356
- else if (active_index === 0 && index_or_direction === 'prev') {
357
- $slides_container.css(margin_position, '-' + ($slides.length - 1) * 100 + '%');
358
- active_index = $slides.length - 2;
359
- }
360
- // Start transition, make next slide active
361
- $container.addClass(self.settings.orbit_transition_class);
362
- $active_slide.removeClass(self.settings.active_slide_class);
363
- $($slides[active_index]).addClass(self.settings.active_slide_class);
364
- // Make next bullet active
365
- var $bullets = $container.siblings('.' + self.settings.bullets_container_class);
366
- if ($bullets.length === 1) {
367
- $bullets.children().removeClass(self.settings.bullets_active_class);
368
- $($bullets.children()[active_index-1]).addClass(self.settings.bullets_active_class);
390
+ if ($(scope).is('[data-orbit]')) {
391
+ var $el = $(scope);
392
+ var opts = self.data_options($el);
393
+ new Orbit($el, $.extend({},self.settings, opts));
369
394
  }
370
- var new_margin_left = '-' + (active_index * 100) + '%';
371
- // Check to see if animation will occur, otherwise perform
372
- // callbacks manually
373
- $slides_container.trigger('orbit:before-slide-change');
374
- if ($slides_container.css(margin_position) === new_margin_left) {
375
- $container.removeClass(self.settings.orbit_transition_class);
376
- $slides_container.trigger('orbit:after-slide-change', [{slide_number: active_index, total_slides: $slides_container.children().length - 2}]);
377
- callback();
378
- } else {
379
- var properties = {};
380
- properties[margin_position] = new_margin_left;
381
395
 
382
- $slides_container.animate(properties, self.settings.animation_speed, 'linear', function() {
383
- $container.removeClass(self.settings.orbit_transition_class);
384
- $slides_container.trigger('orbit:after-slide-change', [{slide_number: active_index, total_slides: $slides_container.children().length - 2}]);
385
- callback();
386
- });
387
- }
396
+ $('[data-orbit]', scope).each(function(idx, el) {
397
+ var $el = $(el);
398
+ var opts = self.data_options($el);
399
+ new Orbit($el, $.extend({},self.settings, opts));
400
+ });
388
401
  }
389
402
  };
390
- }(Foundation.zj, this, this.document));
403
+
404
+
405
+ }(Foundation.zj, this, this.document));