zurb-foundation 4.3.1 → 4.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -0
  3. data/Gemfile.lock +31 -2
  4. data/Gruntfile.js +54 -10
  5. data/LICENSE +2 -2
  6. data/README.md +11 -2
  7. data/Rakefile +9 -0
  8. data/docs/CHANGELOG.md +9 -0
  9. data/docs/Procfile +2 -2
  10. data/docs/components/abide.html.erb +30 -6
  11. data/docs/components/alert-boxes.html.erb +35 -10
  12. data/docs/components/block-grid.html.erb +1 -1
  13. data/docs/components/breadcrumbs.html.erb +4 -4
  14. data/docs/components/button-groups.html.erb +2 -2
  15. data/docs/components/buttons.html.erb +10 -10
  16. data/docs/components/clearing.html.erb +28 -2
  17. data/docs/components/custom-forms.html.erb +9 -1
  18. data/docs/components/dropdown-buttons.html.erb +36 -11
  19. data/docs/components/dropdown.html.erb +44 -13
  20. data/docs/components/flex-video.html.erb +3 -3
  21. data/docs/components/forms.html.erb +10 -10
  22. data/docs/components/global.html.erb +15 -20
  23. data/docs/components/grid.html.erb +24 -23
  24. data/docs/components/inline-lists.html.erb +3 -3
  25. data/docs/components/interchange.html.erb +28 -2
  26. data/docs/components/joyride.html.erb +34 -10
  27. data/docs/components/keystrokes.html.erb +3 -3
  28. data/docs/components/kitchen-sink.html.erb +1 -1
  29. data/docs/components/labels.html.erb +3 -3
  30. data/docs/components/magellan.html.erb +25 -2
  31. data/docs/components/orbit.html.erb +39 -9
  32. data/docs/components/pagination.html.erb +7 -7
  33. data/docs/components/panels.html.erb +3 -3
  34. data/docs/components/pricing-tables.html.erb +11 -11
  35. data/docs/components/progress-bars.html.erb +5 -5
  36. data/docs/components/reveal.html.erb +31 -8
  37. data/docs/components/section.html.erb +61 -37
  38. data/docs/components/side-nav.html.erb +4 -4
  39. data/docs/components/split-buttons.html.erb +37 -15
  40. data/docs/components/sub-nav.html.erb +10 -6
  41. data/docs/components/switch.html.erb +2 -2
  42. data/docs/components/tables.html.erb +7 -7
  43. data/docs/components/tooltips.html.erb +30 -6
  44. data/docs/components/top-bar.html.erb +101 -13
  45. data/docs/components/type.html.erb +16 -16
  46. data/docs/config.ru +18 -1
  47. data/docs/controller.rb +1 -1
  48. data/docs/css/_coderay.scss +2 -2
  49. data/docs/css/_footer.scss +7 -7
  50. data/docs/css/_offcanvas.scss +16 -16
  51. data/docs/css/docs.scss +1 -3
  52. data/docs/index.html.erb +29 -29
  53. data/docs/layout.html.erb +5 -5
  54. data/docs/media-queries.html.erb +3 -3
  55. data/docs/rails.html.erb +2 -1
  56. data/docs/sass.html.erb +188 -146
  57. data/docs/support.html.erb +2 -2
  58. data/foundation.gemspec +1 -0
  59. data/js/foundation/foundation.abide.js +5 -5
  60. data/js/foundation/foundation.alerts.js +9 -4
  61. data/js/foundation/foundation.clearing.js +2 -2
  62. data/js/foundation/foundation.dropdown.js +11 -5
  63. data/js/foundation/foundation.forms.js +51 -28
  64. data/js/foundation/foundation.joyride.js +7 -5
  65. data/js/foundation/foundation.js +25 -1
  66. data/js/foundation/foundation.magellan.js +3 -2
  67. data/js/foundation/foundation.orbit.js +78 -58
  68. data/js/foundation/foundation.placeholder.js +424 -177
  69. data/js/foundation/foundation.reveal.js +39 -16
  70. data/js/foundation/foundation.section.js +62 -32
  71. data/js/foundation/foundation.tooltips.js +3 -2
  72. data/js/foundation/foundation.topbar.js +139 -69
  73. data/lib/foundation/generators/templates/application.html.erb +2 -1
  74. data/lib/foundation/version.rb +1 -1
  75. data/lib/zurb-foundation.rb +12 -0
  76. data/package.json +4 -3
  77. data/scss/foundation/_variables.scss +183 -159
  78. data/scss/foundation/components/_alert-boxes.scss +8 -8
  79. data/scss/foundation/components/_block-grid.scss +1 -1
  80. data/scss/foundation/components/_breadcrumbs.scss +3 -3
  81. data/scss/foundation/components/_button-groups.scss +2 -2
  82. data/scss/foundation/components/_buttons.scss +20 -20
  83. data/scss/foundation/components/_custom-forms.scss +19 -14
  84. data/scss/foundation/components/_dropdown-buttons.scss +8 -8
  85. data/scss/foundation/components/_dropdown.scss +4 -4
  86. data/scss/foundation/components/_flex-video.scss +2 -2
  87. data/scss/foundation/components/_forms.scss +28 -18
  88. data/scss/foundation/components/_global.scss +43 -18
  89. data/scss/foundation/components/_grid-5.scss +4 -4
  90. data/scss/foundation/components/_grid.scss +6 -4
  91. data/scss/foundation/components/_inline-lists.scss +3 -3
  92. data/scss/foundation/components/_joyride.scss +10 -10
  93. data/scss/foundation/components/_keystrokes.scss +2 -2
  94. data/scss/foundation/components/_labels.scss +2 -2
  95. data/scss/foundation/components/_orbit.scss +58 -44
  96. data/scss/foundation/components/_pagination.scss +6 -6
  97. data/scss/foundation/components/_panels.scss +7 -4
  98. data/scss/foundation/components/_pricing-tables.scss +10 -10
  99. data/scss/foundation/components/_progress-bars.scss +3 -3
  100. data/scss/foundation/components/_reveal.scss +5 -5
  101. data/scss/foundation/components/_section.scss +21 -21
  102. data/scss/foundation/components/_side-nav.scss +3 -3
  103. data/scss/foundation/components/_split-buttons.scss +7 -7
  104. data/scss/foundation/components/_sub-nav.scss +26 -10
  105. data/scss/foundation/components/_switch.scss +15 -11
  106. data/scss/foundation/components/_tables.scss +6 -6
  107. data/scss/foundation/components/_thumbs.scss +2 -4
  108. data/scss/foundation/components/_tooltips.scss +4 -4
  109. data/scss/foundation/components/_top-bar.scss +77 -39
  110. data/scss/foundation/components/_type.scss +25 -23
  111. data/scss/foundation/components/_visibility.scss +28 -28
  112. data/scss/normalize.scss +22 -14
  113. data/spec/js/SectionSpec.js +39 -0
  114. data/spec/js/helpers/SectionSpecHelper.js +22 -0
  115. data/spec/js/helpers/SpecHelper.js +19 -0
  116. metadata +32 -25
  117. data/.rbenv-version +0 -1
@@ -68,8 +68,8 @@
68
68
  <div class="row support">
69
69
  <div class="small-3 columns">IE7</div>
70
70
  <div class="small-3 columns"><span class="fail">&#x2717;</span></div>
71
- <div class="small-3 columns"><span data-tooltip title="While we don't officially support IE7, but our UI styles should work for the most part" class="meh has-tip tip-top" data-width="200">&#9679;</span></div>
72
- <div class="small-3 columns"><span data-tooltip title="While we don't officially IE7, but our JS works for the most part. Clearing and tooltips have some issues with style and position." class="meh has-tip tip-top" data-width="200">&#9679;</span></div>
71
+ <div class="small-3 columns"><span data-tooltip title="While we don't officially support IE7, our UI styles should work for the most part" class="meh has-tip tip-top" data-width="200">&#9679;</span></div>
72
+ <div class="small-3 columns"><span data-tooltip title="While we don't officially support IE7, our JS works for the most part. Clearing and tooltips have some issues with style and position." class="meh has-tip tip-top" data-width="200">&#9679;</span></div>
73
73
  </div>
74
74
 
75
75
  <div class="row support">
@@ -17,4 +17,5 @@ Gem::Specification.new do |gem|
17
17
 
18
18
  gem.add_dependency "sass", [">= 3.2.0"]
19
19
  gem.add_development_dependency "rake"
20
+ gem.add_development_dependency "jasmine"
20
21
  end
@@ -6,7 +6,7 @@
6
6
  Foundation.libs.abide = {
7
7
  name : 'abide',
8
8
 
9
- version : '4.3.0',
9
+ version : '4.3.2',
10
10
 
11
11
  settings : {
12
12
  live_validate : true,
@@ -92,11 +92,11 @@
92
92
  validation_count = validations.length,
93
93
  form = $(els[0]).closest('form');
94
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();
95
+ for (var i=0; i < validation_count; i++) {
96
+ if (!validations[i] && /submit/.test(e.type)) {
97
+ if (this.settings.focus_on_invalid) els[i].focus();
98
98
  form.trigger('invalid');
99
- $(els[validation_count]).closest('form').attr('data-invalid', '');
99
+ $(els[i]).closest('form').attr('data-invalid', '');
100
100
  return false;
101
101
  }
102
102
  }
@@ -6,15 +6,17 @@
6
6
  Foundation.libs.alerts = {
7
7
  name : 'alerts',
8
8
 
9
- version : '4.2.2',
9
+ version : '4.3.2',
10
10
 
11
11
  settings : {
12
+ animation: 'fadeOut',
12
13
  speed: 300, // fade out speed
13
14
  callback: function (){}
14
15
  },
15
16
 
16
17
  init : function (scope, method, options) {
17
18
  this.scope = scope || this.scope;
19
+ Foundation.inherit(this, 'data_options');
18
20
 
19
21
  if (typeof method === 'object') {
20
22
  $.extend(true, this.settings, method);
@@ -33,10 +35,13 @@
33
35
  var self = this;
34
36
 
35
37
  $(this.scope).on('click.fndtn.alerts', '[data-alert] a.close', function (e) {
38
+ var alertBox = $(this).closest("[data-alert]"),
39
+ settings = $.extend({}, self.settings, self.data_options(alertBox));
40
+
36
41
  e.preventDefault();
37
- $(this).closest("[data-alert]").fadeOut(self.speed, function () {
42
+ alertBox[settings.animation](settings.speed, function () {
38
43
  $(this).remove();
39
- self.settings.callback();
44
+ settings.callback();
40
45
  });
41
46
  });
42
47
 
@@ -49,4 +54,4 @@
49
54
 
50
55
  reflow : function () {}
51
56
  };
52
- }(Foundation.zj, this, this.document));
57
+ }(Foundation.zj, this, this.document));
@@ -6,7 +6,7 @@
6
6
  Foundation.libs.clearing = {
7
7
  name : 'clearing',
8
8
 
9
- version: '4.3.1',
9
+ version: '4.3.2',
10
10
 
11
11
  settings : {
12
12
  templates : {
@@ -228,7 +228,7 @@
228
228
  },
229
229
 
230
230
  is_open : function (current) {
231
- return current.parent().attr('style').length > 0;
231
+ return current.parent().prop('style').length > 0;
232
232
  },
233
233
 
234
234
  keydown : function (e) {
@@ -6,7 +6,7 @@
6
6
  Foundation.libs.dropdown = {
7
7
  name : 'dropdown',
8
8
 
9
- version : '4.3.0',
9
+ version : '4.3.2',
10
10
 
11
11
  settings : {
12
12
  activeClass: 'open',
@@ -60,10 +60,12 @@
60
60
  $(document).on('click.fndtn.dropdown', function (e) {
61
61
  var parent = $(e.target).closest('[data-dropdown-content]');
62
62
 
63
- if ($(e.target).data('dropdown')) {
63
+ if ($(e.target).data('dropdown') || $(e.target).parent().data('dropdown')) {
64
64
  return;
65
65
  }
66
- if (parent.length > 0 && ($(e.target).is('[data-dropdown-content]') || $.contains(parent.first()[0], e.target))) {
66
+ if (!($(e.target).data('revealId')) &&
67
+ (parent.length > 0 && ($(e.target).is('[data-dropdown-content]') ||
68
+ $.contains(parent.first()[0], e.target)))) {
67
69
  e.stopPropagation();
68
70
  return;
69
71
  }
@@ -99,6 +101,10 @@
99
101
 
100
102
  toggle : function (target) {
101
103
  var dropdown = $('#' + target.data('dropdown'));
104
+ if (dropdown.length === 0) {
105
+ // No dropdown found, not continuing
106
+ return;
107
+ }
102
108
 
103
109
  this.close.call(this, $('[data-dropdown-content]').not(dropdown));
104
110
 
@@ -133,12 +139,12 @@
133
139
  dropdown.css({
134
140
  position : 'absolute',
135
141
  width: '95%',
136
- left: '2.5%',
137
142
  'max-width': 'none',
138
143
  top: position.top + this.outerHeight(target)
139
144
  });
145
+ dropdown.css(Foundation.rtl ? 'right':'left', '2.5%');
140
146
  } else {
141
- if (!Foundation.rtl && $(window).width() > this.outerWidth(dropdown) + target.offset().left) {
147
+ if (!Foundation.rtl && $(window).width() > this.outerWidth(dropdown) + target.offset().left && !this.data_options(target).align_right) {
142
148
  var left = position.left;
143
149
  if (dropdown.hasClass('right')) {
144
150
  dropdown.removeClass('right');
@@ -4,7 +4,7 @@
4
4
  Foundation.libs.forms = {
5
5
  name : 'forms',
6
6
 
7
- version: '4.3.1',
7
+ version: '4.3.2',
8
8
 
9
9
  cache: {},
10
10
 
@@ -33,14 +33,19 @@
33
33
  },
34
34
 
35
35
  assemble: function () {
36
- $('form.custom input[type="radio"]', $(this.scope))
37
- .not('[data-customforms="disabled"]')
38
- .not('.' + this.settings.disable_class)
39
- .each(this.append_custom_markup);
40
- $('form.custom input[type="checkbox"]', $(this.scope))
36
+
37
+ var forms = this;
38
+
39
+ $('form.custom input[type="radio"],[type="checkbox"]', $(this.scope))
41
40
  .not('[data-customforms="disabled"]')
42
41
  .not('.' + this.settings.disable_class)
43
- .each(this.append_custom_markup);
42
+ .each(function(idx, sel){
43
+ forms.set_custom_markup(sel);
44
+ })
45
+ .change(function(){
46
+ forms.set_custom_markup(this);
47
+ });
48
+
44
49
  $('form.custom select', $(this.scope))
45
50
  .not('[data-customforms="disabled"]')
46
51
  .not('.' + this.settings.disable_class)
@@ -165,11 +170,18 @@
165
170
  $(window).on('keydown', function (e) {
166
171
  var focus = document.activeElement,
167
172
  self = Foundation.libs.forms,
168
- dropdown = $('.custom.dropdown.open');
173
+ dropdown = $('.custom.dropdown'),
174
+ select = getFirstPrevSibling(dropdown, 'select'),
175
+ inputs = $('input,select,textarea,button'); // Zepto-compatible jQuery(":input")
169
176
 
170
- if (dropdown.length > 0) {
177
+ if (dropdown.length > 0 && dropdown.hasClass('open')) {
171
178
  e.preventDefault();
172
179
 
180
+ if (e.which === 9) {
181
+ $(inputs[$(inputs).index(select) + 1]).focus();
182
+ dropdown.removeClass('open');
183
+ }
184
+
173
185
  if (e.which === 13) {
174
186
  dropdown.find('li.selected').trigger('click');
175
187
  }
@@ -210,6 +222,15 @@
210
222
  }
211
223
  });
212
224
 
225
+ $(window).on('keyup', function (e) {
226
+ var focus = document.activeElement,
227
+ dropdown = $('.custom.dropdown');
228
+
229
+ if (focus === dropdown.find('.current')[0]) {
230
+ dropdown.find('.selector').focus().click();
231
+ }
232
+ });
233
+
213
234
  this.settings.init = true;
214
235
  },
215
236
 
@@ -240,7 +261,7 @@
240
261
  }.bind(this), 10);
241
262
  },
242
263
 
243
- append_custom_markup: function (idx, sel) {
264
+ set_custom_markup: function (sel) {
244
265
  var $this = $(sel),
245
266
  type = $this.attr('type'),
246
267
  $span = $this.next('span.custom.' + type);
@@ -291,7 +312,7 @@
291
312
  $customList.append(liHtml);
292
313
 
293
314
  $currentSelect = $customSelect
294
- .prepend('<a href="#" class="current">' + $selectedOption.html() + '</a>')
315
+ .prepend('<a href="#" class="current">' + ($selectedOption.html() || '') + '</a>')
295
316
  .find(".current");
296
317
 
297
318
  $this.after($customSelect)
@@ -369,30 +390,27 @@
369
390
  var maxWidth = 0,
370
391
  $customSelect = $select.next(),
371
392
  $options = $select.find('option'),
393
+ $customList = $customSelect.find('ul'),
372
394
  $listItems = $customSelect.find('li');
373
395
 
374
- if ($listItems.length !== this.cache[$customSelect.data('id')] || force_refresh) {
375
- $customSelect.find('ul').html('');
396
+ if ($options.length !== this.cache[$customSelect.data('id')] || force_refresh) {
397
+ $customList.html('');
376
398
 
399
+ // rebuild and re-populate all at once
400
+ var customSelectHtml = '';
377
401
  $options.each(function () {
378
- var $li = $('<li>' + $(this).html() + '</li>');
379
- $customSelect.find('ul').append($li);
380
- });
381
-
382
- // re-populate
383
- $options.each(function (index) {
384
- if (this.selected) {
385
- $customSelect.find('li').eq(index).addClass('selected');
386
- $customSelect.find('.current').html($(this).html());
387
- }
388
- if ($(this).is(':disabled')) {
389
- $customSelect.find('li').eq(index).addClass('disabled');
402
+ var $this = $(this), thisHtml = $this.html(), thisSelected = this.selected;
403
+ customSelectHtml += '<li class="' + (thisSelected ? ' selected ' : '') + ($this.is(':disabled') ? ' disabled ' : '') + '">' + thisHtml + '</li>';
404
+ if (thisSelected) {
405
+ $customSelect.find('.current').html(thisHtml);
390
406
  }
391
407
  });
392
408
 
409
+ $customList.html(customSelectHtml);
410
+
393
411
  // fix width
394
- $customSelect.removeAttr('style')
395
- .find('ul').removeAttr('style');
412
+ $customSelect.removeAttr('style');
413
+ $customList.removeAttr('style');
396
414
  $customSelect.find('li').each(function () {
397
415
  $customSelect.addClass('open');
398
416
  if (self.outerWidth($(this)) > maxWidth) {
@@ -406,6 +424,11 @@
406
424
  this.cache[$customSelect.data('id')] = $listItems.length;
407
425
  }
408
426
  },
427
+
428
+ refresh_custom_selection: function ($select) {
429
+ var selectedValue = $('option:selected', $select).text();
430
+ $('a.current', $select.next()).text(selectedValue);
431
+ },
409
432
 
410
433
  toggle_checkbox: function ($element) {
411
434
  var $input = $element.prev(),
@@ -530,4 +553,4 @@
530
553
  }
531
554
  return $();
532
555
  };
533
- }(Foundation.zj, this, this.document));
556
+ }(Foundation.zj, this, this.document));
@@ -3,10 +3,12 @@
3
3
  (function ($, window, document, undefined) {
4
4
  'use strict';
5
5
 
6
+ var Modernizr = Modernizr || false;
7
+
6
8
  Foundation.libs.joyride = {
7
9
  name : 'joyride',
8
10
 
9
- version : '4.2.2',
11
+ version : '4.3.2',
10
12
 
11
13
  defaults : {
12
14
  expose : false, // turn on or off the expose feature
@@ -121,7 +123,7 @@
121
123
  integer_settings = ['timer', 'scrollSpeed', 'startOffset', 'tipAnimationFadeSpeed', 'cookieExpires'],
122
124
  int_settings_count = integer_settings.length;
123
125
 
124
- if (!this.settings.init) this.init();
126
+ if (!this.settings.init) this.events();
125
127
 
126
128
  // non configureable settings
127
129
  this.settings.$content_el = $this;
@@ -339,7 +341,7 @@
339
341
  return Modernizr.mq('only screen and (max-width: 767px)') || $('.lt-ie9').length > 0;
340
342
  }
341
343
 
342
- return (this.settings.$window.width() < 767);
344
+ return ($(window).width() < 767);
343
345
  },
344
346
 
345
347
  hide : function () {
@@ -605,7 +607,7 @@
605
607
  zIndex: el.css('z-index'),
606
608
  position: el.css('position')
607
609
  };
608
-
610
+
609
611
  origClasses = el.attr('class') == null ? '' : el.attr('class');
610
612
 
611
613
  el.css('z-index',parseInt(expose.css('z-index'))+1);
@@ -684,7 +686,7 @@
684
686
  el.css('position', origCSS.position);
685
687
  }
686
688
  }
687
-
689
+
688
690
  origClasses = el.data('orig-class');
689
691
  el.attr('class', origClasses);
690
692
  el.removeData('orig-classes');
@@ -38,6 +38,10 @@ if (typeof jQuery === "undefined" &&
38
38
  https://github.com/paulirish/matchMedia.js
39
39
  */
40
40
 
41
+ $('head').append('<meta class="foundation-mq-small">');
42
+ $('head').append('<meta class="foundation-mq-medium">');
43
+ $('head').append('<meta class="foundation-mq-large">');
44
+
41
45
  window.matchMedia = window.matchMedia || (function( doc, undefined ) {
42
46
 
43
47
  "use strict";
@@ -166,10 +170,18 @@ if (typeof jQuery === "undefined" &&
166
170
  window.Foundation = {
167
171
  name : 'Foundation',
168
172
 
169
- version : '4.3.1',
173
+ version : '4.3.2',
170
174
 
171
175
  cache : {},
172
176
 
177
+ media_queries : {
178
+ small : $('.foundation-mq-small').css('font-family').replace(/\'/g, ''),
179
+ medium : $('.foundation-mq-medium').css('font-family').replace(/\'/g, ''),
180
+ large : $('.foundation-mq-large').css('font-family').replace(/\'/g, '')
181
+ },
182
+
183
+ stylesheet : $('<style></style>').appendTo('head')[0].sheet,
184
+
173
185
  init : function (scope, libraries, method, options, response, /* internal */ nc) {
174
186
  var library_arr,
175
187
  args = [scope, method, options, response],
@@ -385,6 +397,18 @@ if (typeof jQuery === "undefined" &&
385
397
  }
386
398
 
387
399
  return true;
400
+ },
401
+
402
+ addCustomRule : function(rule, media) {
403
+ if(media === undefined) {
404
+ Foundation.stylesheet.insertRule(rule, Foundation.stylesheet.cssRules.length);
405
+ } else {
406
+ var query = Foundation.media_queries[media];
407
+ if(query !== undefined) {
408
+ Foundation.stylesheet.insertRule('@media ' +
409
+ Foundation.media_queries[media] + '{ ' + rule + ' }');
410
+ }
411
+ }
388
412
  }
389
413
  },
390
414
 
@@ -6,7 +6,7 @@
6
6
  Foundation.libs.magellan = {
7
7
  name : 'magellan',
8
8
 
9
- version : '4.2.2',
9
+ version : '4.3.2',
10
10
 
11
11
  settings : {
12
12
  activeClass: 'active',
@@ -120,7 +120,7 @@
120
120
  },
121
121
 
122
122
  set_threshold : function () {
123
- if (!this.settings.threshold) {
123
+ if (typeof this.settings.threshold !== 'number') {
124
124
  this.settings.threshold = (this.fixed_magellan.length > 0) ?
125
125
  this.outerHeight(this.fixed_magellan, true) : 0;
126
126
  }
@@ -128,6 +128,7 @@
128
128
 
129
129
  off : function () {
130
130
  $(this.scope).off('.fndtn.magellan');
131
+ $(window).off('.fndtn.magellan');
131
132
  },
132
133
 
133
134
  reflow : function () {}
@@ -34,14 +34,20 @@
34
34
  }
35
35
  };
36
36
 
37
+ self.update_active_link = function(index) {
38
+ var link = $('a[data-orbit-link="'+slides_container.children().eq(index).attr('data-orbit-slide')+'"]');
39
+ link.parents('ul').find('[data-orbit-link]').removeClass(settings.bullets_active_class);
40
+ link.addClass(settings.bullets_active_class);
41
+ };
42
+
37
43
  self.build_markup = function() {
38
44
  slides_container.wrap('<div class="'+settings.container_class+'"></div>');
39
45
  container = slides_container.parent();
40
46
  slides_container.addClass(settings.slides_container_class);
41
47
 
42
48
  if (settings.navigation_arrows) {
43
- container.append($('<a>').addClass(settings.prev_class).append('<span>'));
44
- container.append($('<a>').addClass(settings.next_class).append('<span>'));
49
+ container.append($('<a href="#"><span></span></a>').addClass(settings.prev_class));
50
+ container.append($('<a href="#"><span></span></a>').addClass(settings.next_class));
45
51
  }
46
52
 
47
53
  if (settings.timer) {
@@ -54,7 +60,7 @@
54
60
 
55
61
  if (settings.slide_number) {
56
62
  number_container = $('<div>').addClass(settings.slide_number_class);
57
- number_container.append('<span></span> of <span></span>');
63
+ number_container.append('<span></span> ' + settings.slide_number_text + ' <span></span>');
58
64
  container.append(number_container);
59
65
  }
60
66
 
@@ -72,6 +78,7 @@
72
78
  }
73
79
 
74
80
  self.update_slide_number(0);
81
+ self.update_active_link(0);
75
82
  };
76
83
 
77
84
  self._goto = function(next_idx, start_timer) {
@@ -90,10 +97,12 @@
90
97
  var next = $(slides.get(next_idx));
91
98
 
92
99
  current.css('zIndex', 2);
93
- next.css('zIndex', 4).addClass('active');
100
+ current.removeClass(settings.active_slide_class);
101
+ next.css('zIndex', 4).addClass(settings.active_slide_class);
94
102
 
95
103
  slides_container.trigger('orbit:before-slide-change');
96
104
  settings.before_slide_change();
105
+ self.update_active_link(next_idx);
97
106
 
98
107
  var callback = function() {
99
108
  var unlock = function() {
@@ -104,7 +113,7 @@
104
113
  slides_container.trigger('orbit:after-slide-change',[{slide_number: idx, total_slides: slides.length}]);
105
114
  settings.after_slide_change(idx, slides.length);
106
115
  };
107
- if (slides_container.height() != next.height()) {
116
+ if (slides_container.height() != next.height() && settings.variable_height) {
108
117
  slides_container.animate({'height': next.height()}, 250, 'linear', unlock);
109
118
  } else {
110
119
  unlock();
@@ -118,7 +127,7 @@
118
127
  if (dir === 'prev') {animate.prev(current, next, callback);}
119
128
  };
120
129
 
121
- if (next.height() > slides_container.height()) {
130
+ if (next.height() > slides_container.height() && settings.variable_height) {
122
131
  slides_container.animate({'height': next.height()}, 250, 'linear', start_animation);
123
132
  } else {
124
133
  start_animation();
@@ -149,7 +158,7 @@
149
158
  self.link_bullet = function(e) {
150
159
  var index = $(this).attr('data-orbit-slide');
151
160
  if ((typeof index === 'string') && (index = $.trim(index)) != "") {
152
- self._goto(index);
161
+ self._goto(parseInt(index));
153
162
  }
154
163
  }
155
164
 
@@ -195,51 +204,53 @@
195
204
  self.init = function() {
196
205
  self.build_markup();
197
206
  if (settings.timer) {timer = self.create_timer(); timer.start();}
198
- animate = new FadeAnimation(slides_container);
207
+ animate = new FadeAnimation(settings, slides_container);
199
208
  if (settings.animation === 'slide')
200
- animate = new SlideAnimation(slides_container);
209
+ animate = new SlideAnimation(settings, slides_container);
201
210
  container.on('click', '.'+settings.next_class, self.next);
202
211
  container.on('click', '.'+settings.prev_class, self.prev);
203
212
  container.on('click', '[data-orbit-slide]', self.link_bullet);
204
213
  container.on('click', self.toggle_timer);
205
- container.on('touchstart.fndtn.orbit', function(e) {
206
- if (!e.touches) {e = e.originalEvent;}
207
- var data = {
208
- start_page_x: e.touches[0].pageX,
209
- start_page_y: e.touches[0].pageY,
210
- start_time: (new Date()).getTime(),
211
- delta_x: 0,
212
- is_scrolling: undefined
213
- };
214
- container.data('swipe-transition', data);
215
- e.stopPropagation();
216
- })
217
- .on('touchmove.fndtn.orbit', function(e) {
218
- if (!e.touches) { e = e.originalEvent; }
219
- // Ignore pinch/zoom events
220
- if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
221
-
222
- var data = container.data('swipe-transition');
223
- if (typeof data === 'undefined') {data = {};}
224
-
225
- data.delta_x = e.touches[0].pageX - data.start_page_x;
226
-
227
- if ( typeof data.is_scrolling === 'undefined') {
228
- data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
229
- }
230
-
231
- if (!data.is_scrolling && !data.active) {
232
- e.preventDefault();
233
- var direction = (data.delta_x < 0) ? (idx+1) : (idx-1);
234
- data.active = true;
235
- self._goto(direction);
236
- }
237
- })
238
- .on('touchend.fndtn.orbit', function(e) {
239
- container.data('swipe-transition', {});
240
- e.stopPropagation();
241
- })
242
- .on('mouseenter.fndtn.orbit', function(e) {
214
+ if (settings.swipe) {
215
+ container.on('touchstart.fndtn.orbit', function(e) {
216
+ if (!e.touches) {e = e.originalEvent;}
217
+ var data = {
218
+ start_page_x: e.touches[0].pageX,
219
+ start_page_y: e.touches[0].pageY,
220
+ start_time: (new Date()).getTime(),
221
+ delta_x: 0,
222
+ is_scrolling: undefined
223
+ };
224
+ container.data('swipe-transition', data);
225
+ e.stopPropagation();
226
+ })
227
+ .on('touchmove.fndtn.orbit', function(e) {
228
+ if (!e.touches) { e = e.originalEvent; }
229
+ // Ignore pinch/zoom events
230
+ if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
231
+
232
+ var data = container.data('swipe-transition');
233
+ if (typeof data === 'undefined') {data = {};}
234
+
235
+ data.delta_x = e.touches[0].pageX - data.start_page_x;
236
+
237
+ if ( typeof data.is_scrolling === 'undefined') {
238
+ data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
239
+ }
240
+
241
+ if (!data.is_scrolling && !data.active) {
242
+ e.preventDefault();
243
+ var direction = (data.delta_x < 0) ? (idx+1) : (idx-1);
244
+ data.active = true;
245
+ self._goto(direction);
246
+ }
247
+ })
248
+ .on('touchend.fndtn.orbit', function(e) {
249
+ container.data('swipe-transition', {});
250
+ e.stopPropagation();
251
+ })
252
+ }
253
+ container.on('mouseenter.fndtn.orbit', function(e) {
243
254
  if (settings.timer && settings.pause_on_hover) {
244
255
  self.stop_timer();
245
256
  }
@@ -253,6 +264,9 @@
253
264
  $(document).on('click', '[data-orbit-link]', self.link_custom);
254
265
  $(window).on('resize', self.compute_dimensions);
255
266
  $(window).on('load', self.compute_dimensions);
267
+ $(window).on('load', function(){
268
+ container.prev('.preloader').css('display', 'none');
269
+ });
256
270
  slides_container.trigger('orbit:ready');
257
271
  };
258
272
 
@@ -307,13 +321,15 @@
307
321
  };
308
322
  };
309
323
 
310
- var SlideAnimation = function(container) {
311
- var duration = 400;
324
+ var SlideAnimation = function(settings, container) {
325
+ var duration = settings.animation_speed;
312
326
  var is_rtl = ($('html[dir=rtl]').length === 1);
313
327
  var margin = is_rtl ? 'marginRight' : 'marginLeft';
328
+ var animMargin = {};
329
+ animMargin[margin] = '0%';
314
330
 
315
331
  this.next = function(current, next, callback) {
316
- next.animate({margin: '0%'}, duration, 'linear', function() {
332
+ next.animate(animMargin, duration, 'linear', function() {
317
333
  current.css(margin, '100%');
318
334
  callback();
319
335
  });
@@ -321,28 +337,30 @@
321
337
 
322
338
  this.prev = function(current, prev, callback) {
323
339
  prev.css(margin, '-100%');
324
- prev.animate({margin:'0%'}, duration, 'linear', function() {
340
+ prev.animate(animMargin, duration, 'linear', function() {
325
341
  current.css(margin, '100%');
326
342
  callback();
327
343
  });
328
344
  };
329
345
  };
330
346
 
331
- var FadeAnimation = function(container) {
332
- var duration = 250;
347
+ var FadeAnimation = function(settings, container) {
348
+ var duration = settings.animation_speed;
349
+ var is_rtl = ($('html[dir=rtl]').length === 1);
350
+ var margin = is_rtl ? 'marginRight' : 'marginLeft';
333
351
 
334
352
  this.next = function(current, next, callback) {
335
- next.css({'marginLeft':'0%', 'opacity':'0.01'});
353
+ next.css({'margin':'0%', 'opacity':'0.01'});
336
354
  next.animate({'opacity':'1'}, duration, 'linear', function() {
337
- current.css('marginLeft', '100%');
355
+ current.css('margin', '100%');
338
356
  callback();
339
357
  });
340
358
  };
341
359
 
342
360
  this.prev = function(current, prev, callback) {
343
- prev.css({'marginLeft':'0%', 'opacity':'0.01'});
361
+ prev.css({'margin':'0%', 'opacity':'0.01'});
344
362
  prev.animate({'opacity':'1'}, duration, 'linear', function() {
345
- current.css('marginLeft', '100%');
363
+ current.css('margin', '100%');
346
364
  callback();
347
365
  });
348
366
  };
@@ -354,7 +372,7 @@
354
372
  Foundation.libs.orbit = {
355
373
  name: 'orbit',
356
374
 
357
- version: '4.3.1',
375
+ version: '4.3.2',
358
376
 
359
377
  settings: {
360
378
  animation: 'slide',
@@ -365,6 +383,7 @@
365
383
  stack_on_small: false,
366
384
  navigation_arrows: true,
367
385
  slide_number: true,
386
+ slide_number_text: 'of',
368
387
  container_class: 'orbit-container',
369
388
  stack_on_small_class: 'orbit-stack-on-small',
370
389
  next_class: 'orbit-next',
@@ -382,6 +401,7 @@
382
401
  bullets: true,
383
402
  timer: true,
384
403
  variable_height: false,
404
+ swipe: true,
385
405
  before_slide_change: noop,
386
406
  after_slide_change: noop
387
407
  },