foundation-rails 5.1.1.0 → 5.2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +52 -7
  3. data/bower.json +2 -2
  4. data/lib/foundation/rails/version.rb +1 -1
  5. data/vendor/assets/javascripts/foundation/foundation.abide.js +3 -6
  6. data/vendor/assets/javascripts/foundation/foundation.accordion.js +5 -4
  7. data/vendor/assets/javascripts/foundation/foundation.alert.js +1 -1
  8. data/vendor/assets/javascripts/foundation/foundation.clearing.js +70 -34
  9. data/vendor/assets/javascripts/foundation/foundation.dropdown.js +121 -28
  10. data/vendor/assets/javascripts/foundation/foundation.equalizer.js +6 -6
  11. data/vendor/assets/javascripts/foundation/foundation.interchange.js +34 -25
  12. data/vendor/assets/javascripts/foundation/foundation.joyride.js +4 -8
  13. data/vendor/assets/javascripts/foundation/foundation.js +94 -78
  14. data/vendor/assets/javascripts/foundation/foundation.magellan.js +3 -4
  15. data/vendor/assets/javascripts/foundation/foundation.offcanvas.js +19 -1
  16. data/vendor/assets/javascripts/foundation/foundation.orbit.js +151 -102
  17. data/vendor/assets/javascripts/foundation/foundation.reveal.js +43 -15
  18. data/vendor/assets/javascripts/foundation/foundation.slider.js +187 -0
  19. data/vendor/assets/javascripts/foundation/foundation.tab.js +116 -18
  20. data/vendor/assets/javascripts/foundation/foundation.tooltip.js +112 -60
  21. data/vendor/assets/javascripts/foundation/foundation.topbar.js +47 -14
  22. data/vendor/assets/javascripts/vendor/modernizr.js +3 -3
  23. data/vendor/assets/stylesheets/foundation.scss +7 -0
  24. data/vendor/assets/stylesheets/foundation/_functions.scss +4 -0
  25. data/vendor/assets/stylesheets/foundation/_settings.scss +11 -2
  26. data/vendor/assets/stylesheets/foundation/components/_accordion.scss +5 -1
  27. data/vendor/assets/stylesheets/foundation/components/_alert-boxes.scss +4 -0
  28. data/vendor/assets/stylesheets/foundation/components/_block-grid.scss +44 -12
  29. data/vendor/assets/stylesheets/foundation/components/_breadcrumbs.scss +4 -0
  30. data/vendor/assets/stylesheets/foundation/components/_button-groups.scss +4 -0
  31. data/vendor/assets/stylesheets/foundation/components/_buttons.scss +7 -5
  32. data/vendor/assets/stylesheets/foundation/components/_clearing.scss +4 -0
  33. data/vendor/assets/stylesheets/foundation/components/_dropdown-buttons.scss +4 -0
  34. data/vendor/assets/stylesheets/foundation/components/_dropdown.scss +100 -11
  35. data/vendor/assets/stylesheets/foundation/components/_flex-video.scss +4 -0
  36. data/vendor/assets/stylesheets/foundation/components/_forms.scss +25 -21
  37. data/vendor/assets/stylesheets/foundation/components/_global.scss +79 -44
  38. data/vendor/assets/stylesheets/foundation/components/_grid.scss +6 -2
  39. data/vendor/assets/stylesheets/foundation/components/_inline-lists.scss +4 -0
  40. data/vendor/assets/stylesheets/foundation/components/_joyride.scss +4 -0
  41. data/vendor/assets/stylesheets/foundation/components/_keystrokes.scss +5 -1
  42. data/vendor/assets/stylesheets/foundation/components/_labels.scss +4 -0
  43. data/vendor/assets/stylesheets/foundation/components/_magellan.scss +4 -0
  44. data/vendor/assets/stylesheets/foundation/components/_offcanvas.scss +51 -59
  45. data/vendor/assets/stylesheets/foundation/components/_orbit.scss +97 -14
  46. data/vendor/assets/stylesheets/foundation/components/_pagination.scss +7 -2
  47. data/vendor/assets/stylesheets/foundation/components/_panels.scss +5 -1
  48. data/vendor/assets/stylesheets/foundation/components/_pricing-tables.scss +4 -0
  49. data/vendor/assets/stylesheets/foundation/components/_progress-bars.scss +4 -0
  50. data/vendor/assets/stylesheets/foundation/components/_range-slider.scss +148 -0
  51. data/vendor/assets/stylesheets/foundation/components/_reveal.scss +36 -7
  52. data/vendor/assets/stylesheets/foundation/components/_side-nav.scss +8 -3
  53. data/vendor/assets/stylesheets/foundation/components/_split-buttons.scss +4 -0
  54. data/vendor/assets/stylesheets/foundation/components/_sub-nav.scss +6 -2
  55. data/vendor/assets/stylesheets/foundation/components/_switch.scss +4 -0
  56. data/vendor/assets/stylesheets/foundation/components/_tables.scss +4 -0
  57. data/vendor/assets/stylesheets/foundation/components/_tabs.scss +12 -6
  58. data/vendor/assets/stylesheets/foundation/components/_thumbs.scss +4 -0
  59. data/vendor/assets/stylesheets/foundation/components/_tooltips.scss +9 -0
  60. data/vendor/assets/stylesheets/foundation/components/_top-bar.scss +52 -25
  61. data/vendor/assets/stylesheets/foundation/components/_type.scss +132 -75
  62. data/vendor/assets/stylesheets/foundation/components/_visibility.scss +198 -538
  63. data/vendor/assets/stylesheets/normalize.scss +179 -166
  64. metadata +4 -2
@@ -4,14 +4,14 @@
4
4
  Foundation.libs['magellan-expedition'] = {
5
5
  name : 'magellan-expedition',
6
6
 
7
- version : '5.1.1',
7
+ version : '5.2.0',
8
8
 
9
9
  settings : {
10
10
  active_class: 'active',
11
11
  threshold: 0, // pixels from the top of the expedition for it to become fixes
12
12
  destination_threshold: 20, // pixels from the top of destination for it to be considered active
13
13
  throttle_delay: 30 // calculation throttling to increase framerate
14
- },
14
+ },
15
15
 
16
16
  init : function (scope, method, options) {
17
17
  Foundation.inherit(this, 'throttle');
@@ -26,7 +26,6 @@
26
26
  // initialize expedition offset
27
27
  self.set_expedition_position();
28
28
 
29
-
30
29
  S(self.scope)
31
30
  .off('.magellan')
32
31
  .on('click.fndtn.magellan', '[' + self.add_namespace('data-magellan-arrival') + '] a[href^="#"]', function (e) {
@@ -51,7 +50,7 @@
51
50
  });
52
51
  })
53
52
  .on('scroll.fndtn.magellan', self.throttle(this.check_for_arrivals.bind(this), settings.throttle_delay))
54
- .on('resize.fndtn.magellan', self.throttle(this.set_expedition_position.bind(this), settings.throttle_delay));
53
+ $(window).on('resize.fndtn.magellan', self.throttle(this.set_expedition_position.bind(this), settings.throttle_delay));
55
54
  },
56
55
 
57
56
  check_for_arrivals : function() {
@@ -4,7 +4,7 @@
4
4
  Foundation.libs.offcanvas = {
5
5
  name : 'offcanvas',
6
6
 
7
- version : '5.1.1',
7
+ version : '5.2.0',
8
8
 
9
9
  settings : {},
10
10
 
@@ -24,6 +24,15 @@
24
24
  e.preventDefault();
25
25
  S(".off-canvas-wrap").removeClass("move-right");
26
26
  })
27
+ .on('click.fndtn.offcanvas', '.left-off-canvas-menu a', function (e) {
28
+ e.preventDefault();
29
+ var href = $(this).attr('href');
30
+ S('.off-canvas-wrap').on('transitionend webkitTransitionEnd oTransitionEnd', function(e) {
31
+ window.location = href
32
+ S('.off-canvas-wrap').off('transitionend webkitTransitionEnd oTransitionEnd');
33
+ });
34
+ S(".off-canvas-wrap").removeClass("move-right");
35
+ })
27
36
  .on('click.fndtn.offcanvas', '.right-off-canvas-toggle', function (e) {
28
37
  e.preventDefault();
29
38
  S(this).closest(".off-canvas-wrap").toggleClass("move-left");
@@ -31,6 +40,15 @@
31
40
  .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) {
32
41
  e.preventDefault();
33
42
  S(".off-canvas-wrap").removeClass("move-left");
43
+ })
44
+ .on('click.fndtn.offcanvas', '.right-off-canvas-menu a', function (e) {
45
+ e.preventDefault();
46
+ var href = $(this).attr('href');
47
+ S('.off-canvas-wrap').on('transitionend webkitTransitionEnd oTransitionEnd', function(e) {
48
+ window.location = href
49
+ S('.off-canvas-wrap').off('transitionend webkitTransitionEnd oTransitionEnd');
50
+ });
51
+ S(".off-canvas-wrap").removeClass("move-left");
34
52
  });
35
53
  },
36
54
 
@@ -17,10 +17,9 @@
17
17
  timer_container,
18
18
  idx = 0,
19
19
  animate,
20
- timer,
21
- locked = false,
22
20
  adjust_height_after = false;
23
21
 
22
+ self.cache = {};
24
23
 
25
24
  self.slides = function() {
26
25
  return slides_container.children(settings.slide_selector);
@@ -84,15 +83,19 @@
84
83
  }
85
84
  };
86
85
 
87
- self._goto = function(next_idx, start_timer) {
88
- // if (locked) {return false;}
89
- if (next_idx === idx) {return false;}
90
- if (typeof timer === 'object') {timer.restart();}
91
- var slides = self.slides();
92
-
86
+ self._prepare_direction = function(next_idx, current_direction) {
93
87
  var dir = 'next';
94
- locked = true;
95
- if (next_idx < idx) {dir = 'prev';}
88
+ if (next_idx <= idx) { dir = 'prev'; }
89
+
90
+ if (settings.animation === 'slide') {
91
+ setTimeout(function(){
92
+ slides_container.removeClass("swipe-prev swipe-next");
93
+ if (dir === 'next') {slides_container.addClass("swipe-next");}
94
+ else if (dir === 'prev') {slides_container.addClass("swipe-prev");}
95
+ },0);
96
+ }
97
+
98
+ var slides = self.slides();
96
99
  if (next_idx >= slides.length) {
97
100
  if (!settings.circular) return false;
98
101
  next_idx = 0;
@@ -100,26 +103,46 @@
100
103
  if (!settings.circular) return false;
101
104
  next_idx = slides.length - 1;
102
105
  }
106
+ var current = $(slides.get(idx))
107
+ , next = $(slides.get(next_idx));
103
108
 
104
- var current = $(slides.get(idx));
105
- var next = $(slides.get(next_idx));
106
109
 
107
- current.css('zIndex', 2);
108
- current.removeClass(settings.active_slide_class);
109
- next.css('zIndex', 4).addClass(settings.active_slide_class);
110
+ return [dir, current, next, next_idx];
111
+ };
112
+
113
+ self._goto = function(next_idx, start_timer) {
114
+ if (next_idx === null) {return false;}
115
+ if (self.cache.animating) {return false;}
116
+ if (next_idx === idx) {return false;}
117
+ if (typeof self.cache.timer === 'object') {self.cache.timer.restart();}
118
+
119
+ var slides = self.slides();
120
+ self.cache.animating = true;
121
+ var res = self._prepare_direction(next_idx)
122
+ , dir = res[0]
123
+ , current = res[1]
124
+ , next = res[2]
125
+ , next_idx = res[3];
110
126
 
111
127
  slides_container.trigger('before-slide-change.fndtn.orbit');
112
128
  settings.before_slide_change();
113
- self.update_active_link(next_idx);
129
+ idx = next_idx;
130
+
131
+ current.css("transitionDuration", settings.animation_speed+"ms");
132
+ next.css("transitionDuration", settings.animation_speed+"ms");
114
133
 
115
134
  var callback = function() {
116
135
  var unlock = function() {
117
- idx = next_idx;
118
- locked = false;
119
- if (start_timer === true) {timer = self.create_timer(); timer.start();}
136
+ if (start_timer === true) {self.cache.timer.restart();}
120
137
  self.update_slide_number(idx);
138
+ next.addClass(settings.active_slide_class);
139
+ self.update_active_link(next_idx);
121
140
  slides_container.trigger('after-slide-change.fndtn.orbit',[{slide_number: idx, total_slides: slides.length}]);
122
141
  settings.after_slide_change(idx, slides.length);
142
+ setTimeout(function(){
143
+ self.cache.animating = false;
144
+ }, 100);
145
+
123
146
  };
124
147
  if (slides_container.height() != next.height() && settings.variable_height) {
125
148
  slides_container.animate({'height': next.height()}, 250, 'linear', unlock);
@@ -145,13 +168,19 @@
145
168
  self.next = function(e) {
146
169
  e.stopImmediatePropagation();
147
170
  e.preventDefault();
148
- self._goto(idx + 1);
171
+ self._prepare_direction(idx + 1);
172
+ setTimeout(function(){
173
+ self._goto(idx + 1);
174
+ }, 100);
149
175
  };
150
176
 
151
177
  self.prev = function(e) {
152
178
  e.stopImmediatePropagation();
153
179
  e.preventDefault();
154
- self._goto(idx - 1);
180
+ self._prepare_direction(idx - 1);
181
+ setTimeout(function(){
182
+ self._goto(idx - 1)
183
+ }, 100);
155
184
  };
156
185
 
157
186
  self.link_custom = function(e) {
@@ -159,7 +188,11 @@
159
188
  var link = $(this).attr('data-orbit-link');
160
189
  if ((typeof link === 'string') && (link = $.trim(link)) != "") {
161
190
  var slide = container.find('[data-orbit-slide='+link+']');
162
- if (slide.index() != -1) {self._goto(slide.index());}
191
+ if (slide.index() != -1) {
192
+ setTimeout(function(){
193
+ self._goto(slide.index());
194
+ },100);
195
+ }
163
196
  }
164
197
  };
165
198
 
@@ -169,11 +202,17 @@
169
202
  if(isNaN(parseInt(index)))
170
203
  {
171
204
  var slide = container.find('[data-orbit-slide='+index+']');
172
- if (slide.index() != -1) {self._goto(slide.index() + 1);}
205
+ if (slide.index() != -1) {
206
+ setTimeout(function(){
207
+ self._goto(slide.index() + 1);
208
+ },100);
209
+ }
173
210
  }
174
211
  else
175
212
  {
176
- self._goto(parseInt(index));
213
+ setTimeout(function(){
214
+ self._goto(parseInt(index));
215
+ },100);
177
216
  }
178
217
  }
179
218
 
@@ -204,71 +243,98 @@
204
243
  };
205
244
 
206
245
  self.stop_timer = function() {
207
- if (typeof timer === 'object') timer.stop();
246
+ if (typeof self.cache.timer === 'object') self.cache.timer.stop();
208
247
  };
209
248
 
210
249
  self.toggle_timer = function() {
211
250
  var t = container.find('.'+settings.timer_container_class);
212
251
  if (t.hasClass(settings.timer_paused_class)) {
213
- if (typeof timer === 'undefined') {timer = self.create_timer();}
214
- timer.start();
252
+ if (typeof self.cache.timer === 'undefined') {self.cache.timer = self.create_timer();}
253
+ self.cache.timer.start();
215
254
  }
216
255
  else {
217
- if (typeof timer === 'object') {timer.stop();}
256
+ if (typeof self.cache.timer === 'object') {self.cache.timer.stop();}
218
257
  }
219
258
  };
220
259
 
221
260
  self.init = function() {
222
261
  self.build_markup();
223
262
  if (settings.timer) {
224
- timer = self.create_timer();
225
- Foundation.utils.image_loaded(this.slides().children('img'), timer.start);
263
+ self.cache.timer = self.create_timer();
264
+ Foundation.utils.image_loaded(this.slides().children('img'), self.cache.timer.start);
226
265
  }
227
- animate = new FadeAnimation(settings, slides_container);
228
- if (settings.animation === 'slide')
229
- animate = new SlideAnimation(settings, slides_container);
266
+ // animate = new FadeAnimation(settings, slides_container);
267
+ // if (settings.animation === 'slide')
268
+ // animate = new SlideAnimation(settings, slides_container);
269
+ if(settings.animation === 'fade') {slides_container.addClass('fade');}
270
+ animate = new CSSAnimation(settings, slides_container);
230
271
  container.on('click', '.'+settings.next_class, self.next);
231
272
  container.on('click', '.'+settings.prev_class, self.prev);
273
+
232
274
  container.on('click', '[data-orbit-slide]', self.link_bullet);
233
275
  container.on('click', self.toggle_timer);
234
276
  if (settings.swipe) {
235
- container.on('touchstart.fndtn.orbit', function(e) {
236
- if (!e.touches) {e = e.originalEvent;}
237
- var data = {
238
- start_page_x: e.touches[0].pageX,
239
- start_page_y: e.touches[0].pageY,
240
- start_time: (new Date()).getTime(),
241
- delta_x: 0,
242
- is_scrolling: undefined
243
- };
244
- container.data('swipe-transition', data);
277
+ slides_container.on('touchstart.fndtn.orbit',function(e) {
278
+ e.preventDefault();
245
279
  e.stopPropagation();
246
- })
247
- .on('touchmove.fndtn.orbit', function(e) {
248
- if (!e.touches) { e = e.originalEvent; }
249
- // Ignore pinch/zoom events
250
- if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
251
-
252
- var data = container.data('swipe-transition');
253
- if (typeof data === 'undefined') {data = {};}
254
-
255
- data.delta_x = e.touches[0].pageX - data.start_page_x;
256
-
257
- if ( typeof data.is_scrolling === 'undefined') {
258
- data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
259
- }
280
+ if (self.cache.animating) {return;}
281
+ if (!e.touches) {e = e.originalEvent;}
260
282
 
261
- if (!data.is_scrolling && !data.active) {
262
- e.preventDefault();
263
- var direction = (data.delta_x < 0) ? (idx+1) : (idx-1);
264
- data.active = true;
265
- self._goto(direction);
266
- }
283
+ self.cache.start_page_x = e.touches[0].pageX;
284
+ self.cache.start_page_y = e.touches[0].pageY;
285
+ self.cache.start_time = (new Date()).getTime();
286
+ self.cache.delta_x = 0;
287
+ self.cache.is_scrolling = null;
288
+ self.cache.direction = null;
289
+
290
+ self.stop_timer(); // does not appear to prevent callback from occurring
267
291
  })
268
- .on('touchend.fndtn.orbit', function(e) {
269
- container.data('swipe-transition', {});
292
+ .on('touchmove.fndtn.orbit',function(e) {
293
+ if (self.cache.animating) {return;}
294
+ e.preventDefault();
270
295
  e.stopPropagation();
296
+ requestAnimationFrame(function(){
297
+ if (!e.touches) { e = e.originalEvent; }
298
+ // Ignore pinch/zoom events
299
+ if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
300
+
301
+ self.cache.delta_x = e.touches[0].pageX - self.cache.start_page_x;
302
+
303
+ if (self.cache.is_scrolling === null) {
304
+ self.cache.is_scrolling = !!( self.cache.is_scrolling || Math.abs(self.cache.delta_x) < Math.abs(e.touches[0].pageY - self.cache.start_page_y) );
305
+ }
306
+
307
+ if (self.cache.is_scrolling) {return;}
308
+
309
+ var direction = (self.cache.delta_x < 0) ? (idx+1) : (idx-1);
310
+ if (self.cache.direction !== direction) {
311
+ var res = self._prepare_direction(direction);
312
+ self.cache.direction = direction;
313
+ self.cache.dir = res[0];
314
+ self.cache.current = res[1];
315
+ self.cache.next = res[2];
316
+ }
317
+
318
+ if (settings.animation === 'slide') {
319
+ var offset, next_offset;
320
+
321
+ offset = (self.cache.delta_x / container.width()) * 100;
322
+ if (offset >= 0) {next_offset = -(100 - offset);}
323
+ else {next_offset = 100 + offset;}
324
+
325
+ self.cache.current.css("transform","translate3d("+offset+"%,0,0)");
326
+ self.cache.next.css("transform","translate3d("+next_offset+"%,0,0)");
327
+ }
328
+ });
271
329
  })
330
+ .on('touchend.fndtn.orbit', function(e) {
331
+ if (self.cache.animating) {return;}
332
+ e.preventDefault();
333
+ e.stopPropagation();
334
+ setTimeout(function(){
335
+ self._goto(self.cache.direction);
336
+ }, 50);
337
+ });
272
338
  }
273
339
  container.on('mouseenter.fndtn.orbit', function(e) {
274
340
  if (settings.timer && settings.pause_on_hover) {
@@ -277,7 +343,7 @@
277
343
  })
278
344
  .on('mouseleave.fndtn.orbit', function(e) {
279
345
  if (settings.timer && settings.resume_on_mouseout) {
280
- timer.start();
346
+ self.cache.timer.start();
281
347
  }
282
348
  });
283
349
 
@@ -342,51 +408,34 @@
342
408
  el.trigger('timer-stopped.fndtn.orbit');
343
409
  };
344
410
  };
345
-
346
- var SlideAnimation = function(settings, container) {
347
- var duration = settings.animation_speed;
348
- var is_rtl = ($('html[dir=rtl]').length === 1);
349
- var margin = is_rtl ? 'marginRight' : 'marginLeft';
350
- var animMargin = {};
351
- animMargin[margin] = '0%';
352
411
 
353
- this.next = function(current, next, callback) {
354
- current.animate({marginLeft:'-100%'}, duration);
355
- next.animate(animMargin, duration, function() {
356
- current.css(margin, '100%');
357
- callback();
358
- });
359
- };
360
-
361
- this.prev = function(current, prev, callback) {
362
- current.animate({marginLeft:'100%'}, duration);
363
- prev.css(margin, '-100%');
364
- prev.animate(animMargin, duration, function() {
365
- current.css(margin, '100%');
366
- callback();
367
- });
368
- };
369
- };
370
-
371
- var FadeAnimation = function(settings, container) {
372
- var duration = settings.animation_speed;
373
- var is_rtl = ($('html[dir=rtl]').length === 1);
374
- var margin = is_rtl ? 'marginRight' : 'marginLeft';
412
+ var CSSAnimation = function(settings, container) {
413
+ var animation_end = "webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend";
375
414
 
376
415
  this.next = function(current, next, callback) {
377
- next.css({'margin':'0%', 'opacity':'0.01'});
378
- next.animate({'opacity':'1'}, duration, 'linear', function() {
379
- current.css('margin', '100%');
416
+ next.on(animation_end, function(e){
417
+ next.unbind(animation_end);
418
+ current.removeClass("active animate-out");
419
+ next.removeClass("animate-in");
380
420
  callback();
381
421
  });
422
+ container.children().css({
423
+ "transform":"",
424
+ "transitionDuration":""
425
+ });
426
+ current.addClass("animate-out");
427
+ next.addClass("animate-in");
382
428
  };
383
429
 
384
430
  this.prev = function(current, prev, callback) {
385
- prev.css({'margin':'0%', 'opacity':'0.01'});
386
- prev.animate({'opacity':'1'}, duration, 'linear', function() {
387
- current.css('margin', '100%');
431
+ prev.on(animation_end, function(e){
432
+ prev.unbind(animation_end);
433
+ current.removeClass("active animate-out");
434
+ prev.removeClass("animate-in");
388
435
  callback();
389
436
  });
437
+ current.css({"transform":"", "transitionDuration":""}).addClass("animate-out");
438
+ prev.css({"transform":"", "transitionDuration":""}).addClass("animate-in");
390
439
  };
391
440
  };
392
441
 
@@ -396,7 +445,7 @@
396
445
  Foundation.libs.orbit = {
397
446
  name: 'orbit',
398
447
 
399
- version: '5.1.1',
448
+ version: '5.2.0',
400
449
 
401
450
  settings: {
402
451
  animation: 'slide',
@@ -4,7 +4,7 @@
4
4
  Foundation.libs.reveal = {
5
5
  name : 'reveal',
6
6
 
7
- version : '5.1.1',
7
+ version : '5.2.0',
8
8
 
9
9
  locked : false,
10
10
 
@@ -65,7 +65,7 @@
65
65
  });
66
66
 
67
67
  S(document)
68
- .on('click.fndtn.reveal', this.close_targets(), function (e) {
68
+ .on('touchend.fndtn.reveal click.fndtn.reveal', this.close_targets(), function (e) {
69
69
 
70
70
  e.preventDefault();
71
71
 
@@ -73,8 +73,12 @@
73
73
  var settings = S('[' + self.attr_name() + '].open').data(self.attr_name(true) + '-init'),
74
74
  bg_clicked = S(e.target)[0] === S('.' + settings.bg_class)[0];
75
75
 
76
- if (bg_clicked && !settings.close_on_background_click) {
77
- return;
76
+ if (bg_clicked) {
77
+ if (settings.close_on_background_click) {
78
+ e.stopPropagation();
79
+ } else {
80
+ return;
81
+ }
78
82
  }
79
83
 
80
84
  self.locked = true;
@@ -168,8 +172,7 @@
168
172
 
169
173
  if (typeof ajax_settings === 'undefined' || !ajax_settings.url) {
170
174
  if (open_modal.length > 0) {
171
- var open_modal_settings = open_modal.data(self.attr_name(true) + '-init');
172
- this.hide(open_modal, open_modal_settings.css.close);
175
+ this.hide(open_modal, settings.css.close);
173
176
  }
174
177
 
175
178
  this.show(modal, settings.css.open);
@@ -186,8 +189,7 @@
186
189
  self.S(modal).foundation('section', 'reflow');
187
190
 
188
191
  if (open_modal.length > 0) {
189
- var open_modal_settings = open_modal.data(self.attr_name(true));
190
- self.hide(open_modal, open_modal_settings.css.close);
192
+ self.hide(open_modal, settings.css.close);
191
193
  }
192
194
  self.show(modal, settings.css.open);
193
195
  }
@@ -227,7 +229,7 @@
227
229
 
228
230
  if (this.S('.' + this.settings.bg_class).length === 0) {
229
231
  this.settings.bg = $('<div />', {'class': this.settings.bg_class})
230
- .appendTo('body');
232
+ .appendTo('body').hide();
231
233
  }
232
234
 
233
235
  if (this.settings.bg.filter(':visible').length > 0) {
@@ -253,7 +255,11 @@
253
255
  el.detach().appendTo(rootElement);
254
256
  }
255
257
 
256
- if (/pop/i.test(settings.animation)) {
258
+ var animData = getAnimationData(settings.animation);
259
+ if (!animData.animate) {
260
+ this.locked = false;
261
+ }
262
+ if (animData.pop) {
257
263
  css.top = $(window).scrollTop() - el.data('offset') + 'px';
258
264
  var end_css = {
259
265
  top: $(window).scrollTop() + el.data('css-top') + 'px',
@@ -271,7 +277,8 @@
271
277
  }.bind(this), settings.animation_speed / 2);
272
278
  }
273
279
 
274
- if (/fade/i.test(settings.animation)) {
280
+ if (animData.fade) {
281
+ css.top = $(window).scrollTop() + el.data('css-top') + 'px';
275
282
  var end_css = {opacity: 1};
276
283
 
277
284
  return setTimeout(function () {
@@ -291,7 +298,7 @@
291
298
  var settings = this.settings;
292
299
 
293
300
  // should we animate the background?
294
- if (/fade/i.test(settings.animation)) {
301
+ if (getAnimationData(settings.animation).fade) {
295
302
  return el.fadeIn(settings.animation_speed / 2);
296
303
  }
297
304
 
@@ -304,7 +311,11 @@
304
311
  // is modal
305
312
  if (css) {
306
313
  var settings = el.data(this.attr_name(true) + '-init');
307
- if (/pop/i.test(settings.animation)) {
314
+ var animData = getAnimationData(settings.animation);
315
+ if (!animData.animate) {
316
+ this.locked = false;
317
+ }
318
+ if (animData.pop) {
308
319
  var end_css = {
309
320
  top: - $(window).scrollTop() - el.data('offset') + 'px',
310
321
  opacity: 0
@@ -320,7 +331,7 @@
320
331
  }.bind(this), settings.animation_speed / 2);
321
332
  }
322
333
 
323
- if (/fade/i.test(settings.animation)) {
334
+ if (animData.fade) {
324
335
  var end_css = {opacity: 0};
325
336
 
326
337
  return setTimeout(function () {
@@ -339,7 +350,7 @@
339
350
  var settings = this.settings;
340
351
 
341
352
  // should we animate the background?
342
- if (/fade/i.test(settings.animation)) {
353
+ if (getAnimationData(settings.animation).fade) {
343
354
  return el.fadeOut(settings.animation_speed / 2);
344
355
  }
345
356
 
@@ -396,4 +407,21 @@
396
407
 
397
408
  reflow : function () {}
398
409
  };
410
+
411
+ /*
412
+ * getAnimationData('popAndFade') // {animate: true, pop: true, fade: true}
413
+ * getAnimationData('fade') // {animate: true, pop: false, fade: true}
414
+ * getAnimationData('pop') // {animate: true, pop: true, fade: false}
415
+ * getAnimationData('foo') // {animate: false, pop: false, fade: false}
416
+ * getAnimationData(null) // {animate: false, pop: false, fade: false}
417
+ */
418
+ function getAnimationData(str) {
419
+ var fade = /fade/i.test(str);
420
+ var pop = /pop/i.test(str);
421
+ return {
422
+ animate: fade || pop,
423
+ pop: pop,
424
+ fade: fade
425
+ };
426
+ }
399
427
  }(jQuery, this, this.document));