zurb-foundation 3.2.5 → 4.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -2
- data/CHANGELOG.md +1 -26
- data/CONTRIBUTING.md +18 -0
- data/Gemfile.lock +19 -0
- data/Gruntfile.js +27 -0
- data/README.md +5 -6
- data/{Capfile → docs/Capfile} +0 -1
- data/docs/Gemfile +8 -0
- data/docs/Gemfile.lock +43 -0
- data/docs/Procfile +2 -0
- data/docs/README.md +1 -0
- data/docs/_sidebar-components.html.erb +109 -0
- data/docs/_sidebar.html.erb +109 -0
- data/docs/_zurb-jobs.html.erb +5 -0
- data/docs/changelog.html.erb +185 -0
- data/docs/compile.rb +43 -0
- data/docs/components/alert-boxes.html.erb +202 -0
- data/docs/components/block-grid.html.erb +118 -0
- data/docs/components/breadcrumbs.html.erb +146 -0
- data/docs/components/button-groups.html.erb +174 -0
- data/docs/components/buttons.html.erb +220 -0
- data/docs/components/clearing.html.erb +152 -0
- data/docs/components/custom-forms.html.erb +306 -0
- data/docs/components/dropdown-buttons.html.erb +233 -0
- data/docs/components/dropdown.html.erb +186 -0
- data/docs/components/flex-video.html.erb +93 -0
- data/docs/components/forms.html.erb +468 -0
- data/docs/components/grid.html.erb +355 -0
- data/docs/components/inline-lists.html.erb +89 -0
- data/docs/components/joyride.html.erb +178 -0
- data/docs/components/keystrokes.html.erb +74 -0
- data/docs/components/labels.html.erb +98 -0
- data/docs/components/magellan.html.erb +84 -0
- data/docs/components/orbit.html.erb +262 -0
- data/docs/components/pagination.html.erb +181 -0
- data/docs/components/panels.html.erb +121 -0
- data/docs/components/pricing-tables.html.erb +154 -0
- data/docs/components/progress-bars.html.erb +120 -0
- data/docs/components/reveal.html.erb +147 -0
- data/docs/components/section.html.erb +156 -0
- data/docs/components/side-nav.html.erb +122 -0
- data/docs/components/split-buttons.html.erb +218 -0
- data/docs/components/sub-nav.html.erb +120 -0
- data/docs/components/switch.html.erb +288 -0
- data/docs/components/tables.html.erb +123 -0
- data/docs/components/thumbnails.html.erb +87 -0
- data/docs/components/tooltips.html.erb +73 -0
- data/docs/components/top-bar.html.erb +219 -0
- data/docs/components/type.html.erb +359 -0
- data/docs/components/visibility.html.erb +102 -0
- data/docs/config.ru +12 -0
- data/docs/config/deploy.rb +33 -0
- data/docs/controller.rb +43 -0
- data/docs/css/_coderay.scss +116 -0
- data/docs/css/_settings.scss +1 -0
- data/docs/css/docs.scss +174 -0
- data/docs/css/normalize.scss +396 -0
- data/docs/css/qunit-composite.css +13 -0
- data/docs/css/qunit.css +235 -0
- data/docs/faq.html.erb +61 -0
- data/docs/img/demos/demo1-th.png +0 -0
- data/docs/img/demos/demo1.png +0 -0
- data/docs/img/demos/demo2-th.png +0 -0
- data/docs/img/demos/demo2.png +0 -0
- data/docs/img/demos/demo3-th.png +0 -0
- data/docs/img/demos/demo3.png +0 -0
- data/docs/img/demos/demo4-th.png +0 -0
- data/docs/img/demos/demo4.png +0 -0
- data/docs/img/demos/demo5-th.png +0 -0
- data/docs/img/demos/demo5.png +0 -0
- data/docs/index.html.erb +299 -0
- data/docs/javascript.html.erb +133 -0
- data/docs/js/docs.js +3 -0
- data/docs/js/qunit-composite.js +105 -0
- data/docs/js/qunit.js +1977 -0
- data/docs/js/tests/tabs/simple_tabs.html +57 -0
- data/docs/js/tests/tabs/simple_tabs.js +54 -0
- data/docs/js/tests/tooltips/tooltips.html +39 -0
- data/docs/js/tests/tooltips/tooltips.js +11 -0
- data/docs/layout.html.erb +99 -0
- data/docs/rails.html.erb +66 -0
- data/docs/sass.html.erb +299 -0
- data/docs/support.html.erb +134 -0
- data/foundation.gemspec +2 -4
- data/index.html +3 -23
- data/js/foundation/foundation.alerts.js +50 -0
- data/js/foundation/foundation.clearing.js +478 -0
- data/{vendor/assets/javascripts/foundation/jquery.cookie.js → js/foundation/foundation.cookie.js} +3 -1
- data/js/foundation/foundation.dropdown.js +122 -0
- data/js/foundation/foundation.forms.js +403 -0
- data/js/foundation/foundation.joyride.js +613 -0
- data/js/foundation/foundation.js +331 -0
- data/js/foundation/foundation.magellan.js +130 -0
- data/js/foundation/foundation.orbit.js +355 -0
- data/{vendor/assets/javascripts/foundation/jquery.placeholder.js → js/foundation/foundation.placeholder.js} +4 -2
- data/js/foundation/foundation.reveal.js +264 -0
- data/js/foundation/foundation.section.js +180 -0
- data/js/foundation/foundation.tooltips.js +195 -0
- data/js/foundation/foundation.topbar.js +187 -0
- data/js/foundation/index.js +16 -0
- data/{vendor/assets/javascripts/foundation/modernizr.foundation.js → js/vendor/custom.modernizr.js} +0 -0
- data/js/vendor/jquery.js +9597 -0
- data/js/vendor/zepto.js +1782 -0
- data/lib/foundation/engine.rb +8 -1
- data/lib/foundation/generators/install_generator.rb +24 -1
- data/lib/foundation/generators/templates/application.html.erb +20 -6
- data/lib/foundation/generators/templates/application.html.haml +2 -6
- data/lib/foundation/generators/templates/application.html.slim +2 -5
- data/lib/foundation/version.rb +1 -1
- data/lib/zurb-foundation.rb +7 -9
- data/package.json +9 -0
- data/scss/foundation.scss +42 -15
- data/scss/foundation/_foundation-global.scss +226 -0
- data/scss/foundation/components/_alert-boxes.scss +106 -0
- data/scss/foundation/components/_block-grid.scss +63 -0
- data/scss/foundation/components/_breadcrumbs.scss +117 -0
- data/scss/foundation/components/_button-groups.scss +59 -0
- data/scss/foundation/components/_buttons.scss +217 -0
- data/scss/foundation/components/_clearing.scss +209 -0
- data/scss/foundation/components/_custom-forms.scss +232 -0
- data/scss/foundation/components/_dropdown-buttons.scss +114 -0
- data/scss/foundation/components/_dropdown.scss +137 -0
- data/scss/foundation/components/_flex-video.scss +45 -0
- data/scss/foundation/components/_forms.scss +309 -0
- data/scss/foundation/components/_grid.scss +149 -71
- data/scss/foundation/components/_inline-lists.scss +47 -0
- data/scss/foundation/components/_joyride.scss +193 -0
- data/scss/foundation/components/_keystrokes.scss +56 -0
- data/scss/foundation/components/_labels.scss +81 -0
- data/scss/foundation/components/_magellan.scss +15 -0
- data/scss/foundation/components/_orbit.scss +193 -0
- data/scss/foundation/components/_pagination.scss +99 -0
- data/scss/foundation/components/_panels.scss +76 -0
- data/scss/foundation/components/_pricing-tables.scss +130 -0
- data/scss/foundation/components/_progress-bars.scss +68 -0
- data/scss/foundation/components/_reveal.scss +131 -0
- data/scss/foundation/components/_section.scss +194 -0
- data/scss/foundation/components/_side-nav.scss +68 -0
- data/scss/foundation/components/_split-buttons.scss +159 -0
- data/scss/foundation/components/_sub-nav.scss +67 -0
- data/scss/foundation/components/_switch.scss +242 -0
- data/scss/foundation/components/_tables.scss +80 -0
- data/scss/foundation/components/_thumbs.scss +45 -0
- data/scss/foundation/components/_tooltips.scss +113 -0
- data/scss/foundation/components/_top-bar.scss +443 -0
- data/scss/foundation/components/_type.scss +411 -0
- data/scss/foundation/components/_visibility.scss +117 -0
- data/scss/normalize.scss +396 -0
- data/templates/project/config.rb +26 -0
- data/templates/project/index.html +28 -43
- data/templates/project/manifest.rb +21 -28
- data/templates/project/scss/_settings.scss +4 -243
- data/templates/project/scss/app.scss +37 -44
- data/templates/project/scss/normalize.scss +396 -0
- data/test/stylesheets/styles.css +955 -0
- metadata +144 -153
- data/config/deploy.rb +0 -42
- data/lib/foundation/generators/layout_generator.rb +0 -28
- data/scss/foundation/_settings.scss +0 -281
- data/scss/foundation/common/_base.scss +0 -4
- data/scss/foundation/common/_forms.scss +0 -117
- data/scss/foundation/common/_globals.scss +0 -35
- data/scss/foundation/common/_ratios.scss +0 -19
- data/scss/foundation/common/_typography.scss +0 -104
- data/scss/foundation/components/modules/_all.scss +0 -10
- data/scss/foundation/components/modules/_buttons.scss +0 -178
- data/scss/foundation/components/modules/_clearing.scss +0 -61
- data/scss/foundation/components/modules/_joyride.scss +0 -33
- data/scss/foundation/components/modules/_mqueries.scss +0 -458
- data/scss/foundation/components/modules/_navbar.scss +0 -74
- data/scss/foundation/components/modules/_offcanvas.scss +0 -55
- data/scss/foundation/components/modules/_orbit.scss +0 -90
- data/scss/foundation/components/modules/_reveal.scss +0 -34
- data/scss/foundation/components/modules/_tabs.scss +0 -67
- data/scss/foundation/components/modules/_topbar.scss +0 -167
- data/scss/foundation/components/modules/_ui.scss +0 -292
- data/scss/foundation/functions/_all.scss +0 -2
- data/scss/foundation/functions/_convert-number-to-word.scss +0 -10
- data/scss/foundation/functions/_grid-calc.scss +0 -5
- data/scss/foundation/functions/modular-scale.scss +0 -3
- data/scss/foundation/mixins/_all.scss +0 -5
- data/scss/foundation/mixins/_clearfix.scss +0 -13
- data/scss/foundation/mixins/_css-triangle.scss +0 -22
- data/scss/foundation/mixins/_font-size.scss +0 -13
- data/scss/foundation/mixins/_respond-to.scss +0 -11
- data/scss/foundation/mixins/_semantic-grid.scss +0 -66
- data/test/buttons.html +0 -189
- data/test/clearing.html +0 -85
- data/test/config.rb +0 -11
- data/test/elements.html +0 -490
- data/test/forms.html +0 -371
- data/test/grid.html +0 -543
- data/test/images/orbit-demo/demo1.jpeg +0 -0
- data/test/images/orbit-demo/demo2.jpeg +0 -0
- data/test/images/orbit-demo/demo3.jpeg +0 -0
- data/test/images/orbit-demo/slider-background.jpeg +0 -0
- data/test/index.html +0 -83
- data/test/joyride.html +0 -127
- data/test/magellan.html +0 -112
- data/test/navigation.html +0 -269
- data/test/orbit.html +0 -112
- data/test/reveal.html +0 -91
- data/test/scss/_settings.scss +0 -245
- data/test/scss/styles.scss +0 -50
- data/test/tabs.html +0 -197
- data/test/template.html +0 -52
- data/test/topbar-login.html +0 -194
- data/test/topbar.html +0 -139
- data/test/type.html +0 -188
- data/vendor/assets/images/foundation/orbit/bullets.jpg +0 -0
- data/vendor/assets/images/foundation/orbit/left-arrow-small.png +0 -0
- data/vendor/assets/images/foundation/orbit/left-arrow.png +0 -0
- data/vendor/assets/images/foundation/orbit/loading.gif +0 -0
- data/vendor/assets/images/foundation/orbit/mask-black.png +0 -0
- data/vendor/assets/images/foundation/orbit/pause-black.png +0 -0
- data/vendor/assets/images/foundation/orbit/right-arrow-small.png +0 -0
- data/vendor/assets/images/foundation/orbit/right-arrow.png +0 -0
- data/vendor/assets/images/foundation/orbit/rotator-black.png +0 -0
- data/vendor/assets/images/foundation/orbit/timer-black.png +0 -0
- data/vendor/assets/javascripts/foundation/app.js +0 -41
- data/vendor/assets/javascripts/foundation/index.js +0 -19
- data/vendor/assets/javascripts/foundation/jquery.event.move.js +0 -580
- data/vendor/assets/javascripts/foundation/jquery.event.swipe.js +0 -130
- data/vendor/assets/javascripts/foundation/jquery.foundation.accordion.js +0 -47
- data/vendor/assets/javascripts/foundation/jquery.foundation.alerts.js +0 -20
- data/vendor/assets/javascripts/foundation/jquery.foundation.buttons.js +0 -83
- data/vendor/assets/javascripts/foundation/jquery.foundation.clearing.js +0 -413
- data/vendor/assets/javascripts/foundation/jquery.foundation.forms.js +0 -502
- data/vendor/assets/javascripts/foundation/jquery.foundation.joyride.js +0 -639
- data/vendor/assets/javascripts/foundation/jquery.foundation.magellan.js +0 -96
- data/vendor/assets/javascripts/foundation/jquery.foundation.mediaQueryToggle.js +0 -27
- data/vendor/assets/javascripts/foundation/jquery.foundation.navigation.js +0 -55
- data/vendor/assets/javascripts/foundation/jquery.foundation.orbit.js +0 -919
- data/vendor/assets/javascripts/foundation/jquery.foundation.reveal.js +0 -794
- data/vendor/assets/javascripts/foundation/jquery.foundation.tabs.js +0 -66
- data/vendor/assets/javascripts/foundation/jquery.foundation.tooltips.js +0 -211
- data/vendor/assets/javascripts/foundation/jquery.foundation.topbar.js +0 -174
- data/vendor/assets/javascripts/foundation/jquery.js +0 -9555
- data/vendor/assets/javascripts/foundation/jquery.offcanvas.js +0 -50
@@ -0,0 +1,355 @@
|
|
1
|
+
;(function ($, window, document, undefined) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
Foundation.libs = Foundation.libs || {};
|
5
|
+
|
6
|
+
Foundation.libs.orbit = {
|
7
|
+
version: '4.0.0',
|
8
|
+
|
9
|
+
settings: {
|
10
|
+
timer_speed: 10000,
|
11
|
+
animation_speed: 500,
|
12
|
+
bullets: true,
|
13
|
+
stack_on_small: true,
|
14
|
+
container_class: 'orbit-container',
|
15
|
+
stack_on_small_class: 'orbit-stack-on-small',
|
16
|
+
next_class: 'orbit-next',
|
17
|
+
prev_class: 'orbit-prev',
|
18
|
+
timer_container_class: 'orbit-timer',
|
19
|
+
timer_paused_class: 'paused',
|
20
|
+
timer_progress_class: 'orbit-progress',
|
21
|
+
slides_container_class: 'orbit-slides-container',
|
22
|
+
bullets_container_class: 'orbit-bullets',
|
23
|
+
bullets_active_class: 'active',
|
24
|
+
slide_number_class: 'orbit-slide-number',
|
25
|
+
caption_class: 'orbit-caption',
|
26
|
+
active_slide_class: 'active',
|
27
|
+
orbit_transition_class: 'orbit-transitioning'
|
28
|
+
},
|
29
|
+
|
30
|
+
init: function (scope, method, options) {
|
31
|
+
var self = this;
|
32
|
+
|
33
|
+
if (typeof method === 'object') {
|
34
|
+
$.extend(true, self.settings, method);
|
35
|
+
}
|
36
|
+
|
37
|
+
$('[data-orbit]', scope).each($.proxy(self._init, self));
|
38
|
+
},
|
39
|
+
|
40
|
+
_container_html: function() {
|
41
|
+
var self = this;
|
42
|
+
return '<div class="' + self.settings.container_class + '"></div>';
|
43
|
+
},
|
44
|
+
|
45
|
+
_bullets_container_html: function($slides) {
|
46
|
+
var self = this,
|
47
|
+
$list = $('<ol class="' + self.settings.bullets_container_class + '"></ol>');
|
48
|
+
$slides.each(function(idx, slide) {
|
49
|
+
var $item = $('<li data-orbit-slide-number="' + (idx+1) + '" class=""></li>');
|
50
|
+
if (idx === 0) {
|
51
|
+
$item.addClass(self.settings.bullets_active_class);
|
52
|
+
}
|
53
|
+
$list.append($item);
|
54
|
+
});
|
55
|
+
return $list;
|
56
|
+
},
|
57
|
+
|
58
|
+
_slide_number_html: function(slide_number, total_slides) {
|
59
|
+
var self = this,
|
60
|
+
$container = $('<div class="' + self.settings.slide_number_class + '"></div>');
|
61
|
+
$container.append('<span>' + slide_number + '</span> of <span>' + total_slides + '</span>');
|
62
|
+
return $container;
|
63
|
+
},
|
64
|
+
|
65
|
+
_timer_html: function() {
|
66
|
+
var self = this;
|
67
|
+
if (typeof self.settings.timer_speed === 'number' && self.settings.timer_speed > 0) {
|
68
|
+
return '<div class="' + self.settings.timer_container_class
|
69
|
+
+ '"><span></span><div class="' + self.settings.timer_progress_class
|
70
|
+
+ '"></div></div>';
|
71
|
+
} else {
|
72
|
+
return '';
|
73
|
+
}
|
74
|
+
},
|
75
|
+
|
76
|
+
_next_html: function() {
|
77
|
+
var self = this;
|
78
|
+
return '<a href="#" class="' + self.settings.next_class + '">Next <span></span></a>';
|
79
|
+
},
|
80
|
+
|
81
|
+
_prev_html: function() {
|
82
|
+
var self = this;
|
83
|
+
return '<a href="#" class="' + self.settings.prev_class + '">Prev <span></span></a>';
|
84
|
+
},
|
85
|
+
|
86
|
+
_init: function (idx, slider) {
|
87
|
+
var self = this,
|
88
|
+
$slides_container = $(slider),
|
89
|
+
$container = $slides_container.wrap(self._container_html()).parent(),
|
90
|
+
$slides = $slides_container.children();
|
91
|
+
|
92
|
+
$container.append(self._prev_html());
|
93
|
+
$container.append(self._next_html());
|
94
|
+
$slides_container.addClass(self.settings.slides_container_class);
|
95
|
+
if (self.settings.stack_on_small) {
|
96
|
+
$container.addClass(self.settings.stack_on_small_class);
|
97
|
+
}
|
98
|
+
$container.append(self._slide_number_html(1, $slides.length));
|
99
|
+
$container.append(self._timer_html());
|
100
|
+
if (self.settings.bullets) {
|
101
|
+
$container.after(self._bullets_container_html($slides));
|
102
|
+
}
|
103
|
+
// To better support the "sliding" effect it's easier
|
104
|
+
// if we just clone the first and last slides
|
105
|
+
$slides_container.append($slides.first().clone().attr('data-orbit-slide',''));
|
106
|
+
$slides_container.prepend($slides.last().clone().attr('data-orbit-slide',''));
|
107
|
+
// Make the first "real" slide active
|
108
|
+
$slides_container.css('marginLeft', '-100%');
|
109
|
+
$slides.first().addClass(self.settings.active_slide_class);
|
110
|
+
|
111
|
+
self._init_events($slides_container);
|
112
|
+
self._init_dimensions($slides_container);
|
113
|
+
self._start_timer($slides_container);
|
114
|
+
},
|
115
|
+
|
116
|
+
_init_events: function ($slides_container) {
|
117
|
+
var self = this,
|
118
|
+
$container = $slides_container.parent();
|
119
|
+
|
120
|
+
$(window)
|
121
|
+
.on('load.fndtn.orbit', function() {
|
122
|
+
$slides_container.height('');
|
123
|
+
$slides_container.height($slides_container.height($container.height()));
|
124
|
+
$slides_container.trigger('orbit:ready');
|
125
|
+
})
|
126
|
+
.on('resize.fndtn.orbit', function() {
|
127
|
+
$slides_container.height('');
|
128
|
+
$slides_container.height($slides_container.height($container.height()));
|
129
|
+
});
|
130
|
+
|
131
|
+
$(document).on('click.fndtn.orbit', '[data-orbit-link]', function(e) {
|
132
|
+
e.preventDefault();
|
133
|
+
var id = $(e.currentTarget).attr('data-orbit-link'),
|
134
|
+
$slide = $slides_container.find('[data-orbit-slide=' + id + ']').first();
|
135
|
+
|
136
|
+
if ($slide.length === 1) {
|
137
|
+
self._reset_timer($slides_container, true);
|
138
|
+
self.goto($slides_container, $slide.index(), function() {});
|
139
|
+
}
|
140
|
+
});
|
141
|
+
|
142
|
+
$container.siblings('.' + self.settings.bullets_container_class)
|
143
|
+
.on('click.fndtn.orbit', '[data-orbit-slide-number]', function(e) {
|
144
|
+
e.preventDefault();
|
145
|
+
self._reset_timer($slides_container, true);
|
146
|
+
self.goto($slides_container, $(e.currentTarget).data('orbit-slide-number'),function() {});
|
147
|
+
});
|
148
|
+
|
149
|
+
$container
|
150
|
+
.on('orbit:after-slide-change.fndtn.orbit', function(e, orbit) {
|
151
|
+
var $slide_number = $container.find('.' + self.settings.slide_number_class);
|
152
|
+
|
153
|
+
if ($slide_number.length === 1) {
|
154
|
+
$slide_number.replaceWith(self._slide_number_html(orbit.slide_number, orbit.total_slides));
|
155
|
+
}
|
156
|
+
})
|
157
|
+
.on('orbit:next-slide.fndtn.orbit click.fndtn.orbit', '.' + self.settings.next_class, function(e) {
|
158
|
+
e.preventDefault();
|
159
|
+
self._reset_timer($slides_container, true);
|
160
|
+
self.goto($slides_container, 'next', function() {});
|
161
|
+
})
|
162
|
+
.on('orbit:prev-slide.fndtn.orbit click.fndtn.orbit', '.' + self.settings.prev_class, function(e) {
|
163
|
+
e.preventDefault();
|
164
|
+
self._reset_timer($slides_container, true);
|
165
|
+
self.goto($slides_container, 'prev', function() {});
|
166
|
+
})
|
167
|
+
.on('orbit:toggle-play-pause.fndtn.orbit click.fndtn.orbit touchstart.fndtn.orbit', '.' + self.settings.timer_container_class, function(e) {
|
168
|
+
e.preventDefault();
|
169
|
+
var $timer = $(e.currentTarget).toggleClass(self.settings.timer_paused_class),
|
170
|
+
$slides_container = $timer.closest('.' + self.settings.container_class)
|
171
|
+
.find('.' + self.settings.slides_container_class);
|
172
|
+
|
173
|
+
if ($timer.hasClass(self.settings.timer_paused_class)) {
|
174
|
+
self._stop_timer($slides_container);
|
175
|
+
} else {
|
176
|
+
self._start_timer($slides_container);
|
177
|
+
}
|
178
|
+
})
|
179
|
+
.on('touchstart.fndtn.orbit', function(e) {
|
180
|
+
var data = {
|
181
|
+
start_page_x: e.touches[0].pageX,
|
182
|
+
start_page_y: e.touches[0].pageY,
|
183
|
+
start_time: (new Date()).getTime(),
|
184
|
+
delta_x: 0,
|
185
|
+
is_scrolling: undefined
|
186
|
+
};
|
187
|
+
$container.data('swipe-transition', data);
|
188
|
+
e.stopPropagation();
|
189
|
+
})
|
190
|
+
.on('touchmove.fndtn.orbit', function(e) {
|
191
|
+
// Ignore pinch/zoom events
|
192
|
+
if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
|
193
|
+
|
194
|
+
var data = $container.data('swipe-transition');
|
195
|
+
if (typeof data === 'undefined') {
|
196
|
+
data = {};
|
197
|
+
}
|
198
|
+
|
199
|
+
data.delta_x = e.touches[0].pageX - data.start_page_x;
|
200
|
+
|
201
|
+
if ( typeof data.is_scrolling === 'undefined') {
|
202
|
+
data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
|
203
|
+
}
|
204
|
+
|
205
|
+
if (!data.is_scrolling && !data.active) {
|
206
|
+
e.preventDefault();
|
207
|
+
self._stop_timer($slides_container);
|
208
|
+
var direction = (data.delta_x < 0) ? 'next' : 'prev';
|
209
|
+
data.active = true;
|
210
|
+
self.goto($slides_container, direction, function() {});
|
211
|
+
}
|
212
|
+
})
|
213
|
+
.on('touchend.fndtn.orbit', function(e) {
|
214
|
+
$container.data('swipe-transition', {});
|
215
|
+
e.stopPropagation();
|
216
|
+
});
|
217
|
+
},
|
218
|
+
|
219
|
+
_init_dimensions: function ($slides_container) {
|
220
|
+
var $container = $slides_container.parent(),
|
221
|
+
$slides = $slides_container.children();
|
222
|
+
|
223
|
+
$slides_container.css('width', $slides.length * 100 + '%');
|
224
|
+
$slides.css('width', 100 / $slides.length + '%');
|
225
|
+
$slides_container.height($container.height());
|
226
|
+
$slides_container.css('width', $slides.length * 100 + '%');
|
227
|
+
},
|
228
|
+
|
229
|
+
_start_timer: function ($slides_container) {
|
230
|
+
var self = this,
|
231
|
+
$container = $slides_container.parent();
|
232
|
+
|
233
|
+
var callback = function() {
|
234
|
+
self._reset_timer($slides_container, false);
|
235
|
+
self.goto($slides_container, 'next', function() {
|
236
|
+
self._start_timer($slides_container);
|
237
|
+
});
|
238
|
+
};
|
239
|
+
|
240
|
+
var $timer = $container.find('.' + self.settings.timer_container_class),
|
241
|
+
$progress = $timer.find('.' + self.settings.timer_progress_class),
|
242
|
+
progress_pct = ($progress.width() / $timer.width()),
|
243
|
+
delay = self.settings.timer_speed - (progress_pct * self.settings.timer_speed);
|
244
|
+
|
245
|
+
$progress.animate({'width': '100%'}, delay, 'linear', callback).data('is-original', 'beans?');
|
246
|
+
$slides_container.trigger('orbit:timer-started');
|
247
|
+
},
|
248
|
+
|
249
|
+
_stop_timer: function ($slides_container) {
|
250
|
+
var self = this,
|
251
|
+
$container = $slides_container.parent(),
|
252
|
+
$timer = $container.find('.' + self.settings.timer_container_class),
|
253
|
+
$progress = $timer.find('.' + self.settings.timer_progress_class),
|
254
|
+
progress_pct = $progress.width() / $timer.width()
|
255
|
+
self._rebuild_timer($container, progress_pct * 100 + '%');
|
256
|
+
// $progress.stop();
|
257
|
+
$slides_container.trigger('orbit:timer-stopped');
|
258
|
+
$timer = $container.find('.' + self.settings.timer_container_class);
|
259
|
+
$timer.addClass(self.settings.timer_paused_class);
|
260
|
+
},
|
261
|
+
|
262
|
+
_reset_timer: function($slides_container, is_paused) {
|
263
|
+
var self = this,
|
264
|
+
$container = $slides_container.parent();
|
265
|
+
self._rebuild_timer($container, '0%');
|
266
|
+
if (typeof is_paused === 'boolean' && is_paused) {
|
267
|
+
var $timer = $container.find('.' + self.settings.timer_container_class);
|
268
|
+
$timer.addClass(self.settings.timer_paused_class);
|
269
|
+
}
|
270
|
+
},
|
271
|
+
|
272
|
+
_rebuild_timer: function ($container, width_pct) {
|
273
|
+
// Zepto is unable to stop animations since they
|
274
|
+
// are css-based. This is a workaround for that
|
275
|
+
// limitation, which rebuilds the dom element
|
276
|
+
// thus stopping the animation
|
277
|
+
var self = this,
|
278
|
+
$timer = $container.find('.' + self.settings.timer_container_class),
|
279
|
+
$new_timer = $(self._timer_html()),
|
280
|
+
$new_timer_progress = $new_timer.find('.' + self.settings.timer_progress_class);
|
281
|
+
|
282
|
+
if (typeof Zepto === 'function') {
|
283
|
+
$timer.remove();
|
284
|
+
$container.append($new_timer);
|
285
|
+
$new_timer_progress.css('width', width_pct);
|
286
|
+
} else if (typeof jQuery === 'function') {
|
287
|
+
var $progress = $timer.find('.' + self.settings.timer_progress_class);
|
288
|
+
$progress.css('width', width_pct);
|
289
|
+
$progress.stop();
|
290
|
+
}
|
291
|
+
},
|
292
|
+
|
293
|
+
goto: function($slides_container, index_or_direction, callback) {
|
294
|
+
var self = this,
|
295
|
+
$container = $slides_container.parent(),
|
296
|
+
$slides = $slides_container.children(),
|
297
|
+
$active_slide = $slides_container.find('.' + self.settings.active_slide_class),
|
298
|
+
active_index = $active_slide.index();
|
299
|
+
|
300
|
+
if ($container.hasClass(self.settings.orbit_transition_class)) {
|
301
|
+
return false;
|
302
|
+
}
|
303
|
+
|
304
|
+
if (index_or_direction === 'prev') {
|
305
|
+
if (active_index === 0) {
|
306
|
+
active_index = $slides.length - 1;
|
307
|
+
}
|
308
|
+
else {
|
309
|
+
active_index--;
|
310
|
+
}
|
311
|
+
}
|
312
|
+
else if (index_or_direction === 'next') {
|
313
|
+
active_index = (active_index+1) % $slides.length;
|
314
|
+
}
|
315
|
+
else if (typeof index_or_direction === 'number') {
|
316
|
+
active_index = (index_or_direction % $slides.length);
|
317
|
+
}
|
318
|
+
if (active_index === ($slides.length - 1) && index_or_direction === 'next') {
|
319
|
+
$slides_container.css('marginLeft', '0%');
|
320
|
+
active_index = 1;
|
321
|
+
}
|
322
|
+
else if (active_index === 0 && index_or_direction === 'prev') {
|
323
|
+
$slides_container.css('marginLeft', '-' + ($slides.length - 1) * 100 + '%');
|
324
|
+
active_index = $slides.length - 2;
|
325
|
+
}
|
326
|
+
// Start transition, make next slide active
|
327
|
+
$container.addClass(self.settings.orbit_transition_class);
|
328
|
+
$active_slide.removeClass(self.settings.active_slide_class);
|
329
|
+
$($slides[active_index]).addClass(self.settings.active_slide_class);
|
330
|
+
// Make next bullet active
|
331
|
+
var $bullets = $container.siblings('.' + self.settings.bullets_container_class);
|
332
|
+
if ($bullets.length === 1) {
|
333
|
+
$bullets.children().removeClass(self.settings.bullets_active_class);
|
334
|
+
$($bullets.children()[active_index-1]).addClass(self.settings.bullets_active_class);
|
335
|
+
}
|
336
|
+
var new_margin_left = '-' + (active_index * 100) + '%';
|
337
|
+
// Check to see if animation will occur, otherwise perform
|
338
|
+
// callbacks manually
|
339
|
+
$slides_container.trigger('orbit:before-slide-change');
|
340
|
+
if ($slides_container.css('marginLeft') === new_margin_left) {
|
341
|
+
$container.removeClass(self.settings.orbit_transition_class);
|
342
|
+
$slides_container.trigger('orbit:after-slide-change', [{slide_number: active_index, total_slides: $slides_container.children().length - 2}]);
|
343
|
+
callback();
|
344
|
+
} else {
|
345
|
+
$slides_container.animate({
|
346
|
+
'marginLeft' : new_margin_left
|
347
|
+
}, self.settings.animation_speed, 'linear', function() {
|
348
|
+
$container.removeClass(self.settings.orbit_transition_class);
|
349
|
+
$slides_container.trigger('orbit:after-slide-change', [{slide_number: active_index, total_slides: $slides_container.children().length - 2}]);
|
350
|
+
callback();
|
351
|
+
});
|
352
|
+
}
|
353
|
+
}
|
354
|
+
};
|
355
|
+
}(Foundation.zj, this, this.document));
|
@@ -1,4 +1,6 @@
|
|
1
|
-
/*! http://mths.be/placeholder v2.0.7 by @mathias
|
1
|
+
/*! http://mths.be/placeholder v2.0.7 by @mathias
|
2
|
+
Modified to work with Zepto.js by ZURB
|
3
|
+
*/
|
2
4
|
;(function(window, document, $) {
|
3
5
|
|
4
6
|
var isInputSupported = 'placeholder' in document.createElement('input'),
|
@@ -154,4 +156,4 @@
|
|
154
156
|
}
|
155
157
|
}
|
156
158
|
|
157
|
-
}(this, document,
|
159
|
+
}(this, document, Foundation.zj));
|
@@ -0,0 +1,264 @@
|
|
1
|
+
/*jslint unparam: true, browser: true, indent: 2 */
|
2
|
+
|
3
|
+
;(function ($, window, document, undefined) {
|
4
|
+
'use strict';
|
5
|
+
|
6
|
+
Foundation.libs.reveal = {
|
7
|
+
name: 'reveal',
|
8
|
+
|
9
|
+
version : '4.0.0',
|
10
|
+
|
11
|
+
locked : false,
|
12
|
+
|
13
|
+
settings : {
|
14
|
+
animation: 'fadeAndPop',
|
15
|
+
animationSpeed: 250,
|
16
|
+
closeOnBackgroundClick: true,
|
17
|
+
dismissModalClass: 'close-reveal-modal',
|
18
|
+
bgClass: 'reveal-modal-bg',
|
19
|
+
open: function(){},
|
20
|
+
opened: function(){},
|
21
|
+
close: function(){},
|
22
|
+
closed: function(){},
|
23
|
+
bg : $('.reveal-modal-bg'),
|
24
|
+
css : {
|
25
|
+
open : {
|
26
|
+
'opacity': 0,
|
27
|
+
'visibility': 'visible',
|
28
|
+
'display' : 'block'
|
29
|
+
},
|
30
|
+
close : {
|
31
|
+
'opacity': 1,
|
32
|
+
'visibility': 'hidden',
|
33
|
+
'display': 'none'
|
34
|
+
}
|
35
|
+
}
|
36
|
+
},
|
37
|
+
|
38
|
+
init : function (scope, method, options) {
|
39
|
+
this.scope = scope || this.scope;
|
40
|
+
Foundation.inherit(this, 'data_options delay');
|
41
|
+
|
42
|
+
if (typeof method === 'object') {
|
43
|
+
$.extend(true, this.settings, method);
|
44
|
+
}
|
45
|
+
|
46
|
+
if (typeof method != 'string') {
|
47
|
+
if (!this.settings.init) this.events();
|
48
|
+
|
49
|
+
return this.settings.init;
|
50
|
+
} else {
|
51
|
+
return this[method].call(this, options);
|
52
|
+
}
|
53
|
+
},
|
54
|
+
|
55
|
+
events : function () {
|
56
|
+
var self = this;
|
57
|
+
|
58
|
+
$(this.scope)
|
59
|
+
.on('click.fndtn.reveal', '[data-reveal-id]', function (e) {
|
60
|
+
e.preventDefault();
|
61
|
+
if (!self.locked) {
|
62
|
+
self.locked = true;
|
63
|
+
self.open.call(self, $(this));
|
64
|
+
}
|
65
|
+
})
|
66
|
+
.on('click.fndtn.reveal touchend.click.fndtn.reveal', this.close_targets(), function (e) {
|
67
|
+
if (!self.locked) {
|
68
|
+
self.locked = true;
|
69
|
+
self.close.call(self, $(this).closest('.reveal-modal'));
|
70
|
+
}
|
71
|
+
})
|
72
|
+
.on('open.fndtn.reveal', '.reveal-modal', this.settings.open)
|
73
|
+
.on('opened.fndtn.reveal', '.reveal-modal', this.settings.opened)
|
74
|
+
.on('opened.fndtn.reveal', '.reveal-modal', this.open_video)
|
75
|
+
.on('close.fndtn.reveal', '.reveal-modal', this.settings.close)
|
76
|
+
.on('closed.fndtn.reveal', '.reveal-modal', this.settings.closed)
|
77
|
+
.on('closed.fndtn.reveal', '.reveal-modal', this.close_video);
|
78
|
+
},
|
79
|
+
|
80
|
+
open : function (target) {
|
81
|
+
var modal = $('#' + target.data('reveal-id')),
|
82
|
+
open_modal = $('.reveal-modal.open');
|
83
|
+
|
84
|
+
this.offset = this.cache_offset(modal);
|
85
|
+
|
86
|
+
modal.trigger('open');
|
87
|
+
|
88
|
+
if (open_modal.length < 1) {
|
89
|
+
this.toggle_bg(modal);
|
90
|
+
}
|
91
|
+
|
92
|
+
this.toggle_modals(open_modal, modal);
|
93
|
+
},
|
94
|
+
|
95
|
+
close : function (modal) {
|
96
|
+
this.locked = true;
|
97
|
+
var open_modal = $('.reveal-modal.open').not(modal);
|
98
|
+
modal.trigger('close');
|
99
|
+
this.toggle_bg(modal);
|
100
|
+
this.toggle_modals(open_modal, modal);
|
101
|
+
},
|
102
|
+
|
103
|
+
close_targets : function () {
|
104
|
+
var base = '.' + this.settings.dismissModalClass;
|
105
|
+
|
106
|
+
if (this.settings.closeOnBackgroundClick) {
|
107
|
+
return base + ', .' + this.settings.bgClass;
|
108
|
+
}
|
109
|
+
|
110
|
+
return base;
|
111
|
+
},
|
112
|
+
|
113
|
+
toggle_modals : function (open_modal, modal) {
|
114
|
+
if (open_modal.length > 0) {
|
115
|
+
this.hide(open_modal, this.settings.css.close);
|
116
|
+
}
|
117
|
+
|
118
|
+
if (modal.filter(':visible').length > 0) {
|
119
|
+
this.hide(modal, this.settings.css.close);
|
120
|
+
} else {
|
121
|
+
this.show(modal, this.settings.css.open);
|
122
|
+
}
|
123
|
+
},
|
124
|
+
|
125
|
+
toggle_bg : function (modal) {
|
126
|
+
if (this.settings.bg.length === 0) {
|
127
|
+
this.settings.bg = $('<div />', {'class': this.settings.bgClass})
|
128
|
+
.insertAfter(modal);
|
129
|
+
}
|
130
|
+
|
131
|
+
if (this.settings.bg.filter(':visible').length > 0) {
|
132
|
+
this.hide(this.settings.bg);
|
133
|
+
} else {
|
134
|
+
this.show(this.settings.bg);
|
135
|
+
}
|
136
|
+
},
|
137
|
+
|
138
|
+
show : function (el, css) {
|
139
|
+
// is modal
|
140
|
+
if (css) {
|
141
|
+
if (/pop/i.test(this.settings.animation)) {
|
142
|
+
css.top = $(window).scrollTop() - this.offset + 'px';
|
143
|
+
var end_css = {
|
144
|
+
top: $(window).scrollTop() + parseInt(el.css('top'), 10) + 'px',
|
145
|
+
opacity: 1
|
146
|
+
}
|
147
|
+
|
148
|
+
return this.delay(function () {
|
149
|
+
return el
|
150
|
+
.css(css)
|
151
|
+
.animate(end_css, this.settings.animationSpeed, 'linear', function () {
|
152
|
+
this.locked = false;
|
153
|
+
el.trigger('opened');
|
154
|
+
}.bind(this))
|
155
|
+
.addClass('open');
|
156
|
+
}.bind(this), this.settings.animationSpeed / 2);
|
157
|
+
}
|
158
|
+
|
159
|
+
if (/fade/i.test(this.settings.animation)) {
|
160
|
+
var end_css = {opacity: 1};
|
161
|
+
|
162
|
+
return this.delay(function () {
|
163
|
+
return el
|
164
|
+
.css(css)
|
165
|
+
.animate(end_css, this.settings.animationSpeed, 'linear', function () {
|
166
|
+
this.locked = false;
|
167
|
+
el.trigger('opened');
|
168
|
+
}.bind(this))
|
169
|
+
.addClass('open');
|
170
|
+
}.bind(this), this.settings.animationSpeed / 2);
|
171
|
+
}
|
172
|
+
|
173
|
+
return el.css(css).show().css({opacity: 1}).addClass('open').trigger('opened');
|
174
|
+
}
|
175
|
+
|
176
|
+
// should we animate the background?
|
177
|
+
if (/fade/i.test(this.settings.animation)) {
|
178
|
+
return el.fadeIn(this.settings.animationSpeed / 2);
|
179
|
+
}
|
180
|
+
|
181
|
+
return el.show();
|
182
|
+
},
|
183
|
+
|
184
|
+
hide : function (el, css) {
|
185
|
+
// is modal
|
186
|
+
if (css) {
|
187
|
+
if (/pop/i.test(this.settings.animation)) {
|
188
|
+
var end_css = {
|
189
|
+
// need to figure out why this doesn't work.
|
190
|
+
// top: $(window).scrollTop() - this.offset + 'px',
|
191
|
+
opacity: 0
|
192
|
+
};
|
193
|
+
|
194
|
+
return this.delay(function () {
|
195
|
+
return el
|
196
|
+
.animate(end_css, this.settings.animationSpeed, 'linear', function () {
|
197
|
+
this.locked = false;
|
198
|
+
el.css(css).trigger('closed');
|
199
|
+
}.bind(this))
|
200
|
+
.removeClass('open');
|
201
|
+
}.bind(this), this.settings.animationSpeed / 2);
|
202
|
+
}
|
203
|
+
|
204
|
+
if (/fade/i.test(this.settings.animation)) {
|
205
|
+
var end_css = {opacity: 0};
|
206
|
+
|
207
|
+
return this.delay(function () {
|
208
|
+
return el
|
209
|
+
.animate(end_css, this.settings.animationSpeed, 'linear', function () {
|
210
|
+
this.locked = false;
|
211
|
+
el.css(css).trigger('closed');
|
212
|
+
}.bind(this))
|
213
|
+
.removeClass('open');
|
214
|
+
}.bind(this), this.settings.animationSpeed / 2);
|
215
|
+
}
|
216
|
+
|
217
|
+
return el.hide().css(css).removeClass('open').trigger('closed');
|
218
|
+
}
|
219
|
+
|
220
|
+
// should we animate the background?
|
221
|
+
if (/fade/i.test(this.settings.animation)) {
|
222
|
+
return el.fadeOut(this.settings.animationSpeed / 2);
|
223
|
+
}
|
224
|
+
|
225
|
+
return el.hide();
|
226
|
+
},
|
227
|
+
|
228
|
+
close_video : function (e) {
|
229
|
+
var video = $(this).find('.flex-video'),
|
230
|
+
iframe = video.find('iframe');
|
231
|
+
|
232
|
+
if (iframe.length > 0) {
|
233
|
+
iframe.attr('data-src', iframe[0].src);
|
234
|
+
iframe.attr('src', 'about:blank');
|
235
|
+
video.fadeOut(100).hide();
|
236
|
+
}
|
237
|
+
},
|
238
|
+
|
239
|
+
open_video : function (e) {
|
240
|
+
var video = $(this).find('.flex-video'),
|
241
|
+
iframe = video.find('iframe');
|
242
|
+
|
243
|
+
if (iframe.length > 0) {
|
244
|
+
var data_src = iframe.attr('data-src');
|
245
|
+
if (typeof data_src === 'string') {
|
246
|
+
iframe[0].src = iframe.attr('data-src');
|
247
|
+
}
|
248
|
+
video.show().fadeIn(100);
|
249
|
+
}
|
250
|
+
},
|
251
|
+
|
252
|
+
cache_offset : function (modal) {
|
253
|
+
var offset = modal.show().height() + parseInt(modal.css('top'), 10);
|
254
|
+
|
255
|
+
modal.hide();
|
256
|
+
|
257
|
+
return offset;
|
258
|
+
},
|
259
|
+
|
260
|
+
off : function () {
|
261
|
+
$(this.scope).off('.fndtn.reveal');
|
262
|
+
}
|
263
|
+
};
|
264
|
+
}(Foundation.zj, this, this.document));
|