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,331 @@
|
|
1
|
+
/*
|
2
|
+
* Foundation Responsive Library 4.0.0
|
3
|
+
* http://foundation.zurb.com
|
4
|
+
* Copyright 2013, ZURB
|
5
|
+
* Free to use under the MIT license.
|
6
|
+
* http://www.opensource.org/licenses/mit-license.php
|
7
|
+
*/
|
8
|
+
|
9
|
+
/*jslint unparam: true, browser: true, indent: 2 */
|
10
|
+
|
11
|
+
(function () {
|
12
|
+
// add dusty browser stuff
|
13
|
+
if (!Array.prototype.filter) {
|
14
|
+
Array.prototype.filter = function(fun /*, thisp */) {
|
15
|
+
"use strict";
|
16
|
+
|
17
|
+
if (this == null) {
|
18
|
+
throw new TypeError();
|
19
|
+
}
|
20
|
+
|
21
|
+
var t = Object(this),
|
22
|
+
len = t.length >>> 0;
|
23
|
+
if (typeof fun != "function") {
|
24
|
+
try {
|
25
|
+
throw new TypeError();
|
26
|
+
} catch (e) {
|
27
|
+
return;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
var res = [],
|
32
|
+
thisp = arguments[1];
|
33
|
+
for (var i = 0; i < len; i++) {
|
34
|
+
if (i in t) {
|
35
|
+
var val = t[i]; // in case fun mutates this
|
36
|
+
if (fun && fun.call(thisp, val, i, t)) {
|
37
|
+
res.push(val);
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
return res;
|
43
|
+
};
|
44
|
+
|
45
|
+
if (!Function.prototype.bind) {
|
46
|
+
Function.prototype.bind = function (oThis) {
|
47
|
+
if (typeof this !== "function") {
|
48
|
+
// closest thing possible to the ECMAScript 5 internal IsCallable function
|
49
|
+
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
|
50
|
+
}
|
51
|
+
|
52
|
+
var aArgs = Array.prototype.slice.call(arguments, 1),
|
53
|
+
fToBind = this,
|
54
|
+
fNOP = function () {},
|
55
|
+
fBound = function () {
|
56
|
+
return fToBind.apply(this instanceof fNOP && oThis
|
57
|
+
? this
|
58
|
+
: oThis,
|
59
|
+
aArgs.concat(Array.prototype.slice.call(arguments)));
|
60
|
+
};
|
61
|
+
|
62
|
+
fNOP.prototype = this.prototype;
|
63
|
+
fBound.prototype = new fNOP();
|
64
|
+
|
65
|
+
return fBound;
|
66
|
+
};
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
// fake stop() for zepto.
|
71
|
+
$.fn.stop = $.fn.stop || function() {
|
72
|
+
return this;
|
73
|
+
};
|
74
|
+
}());
|
75
|
+
|
76
|
+
;(function (window, document, undefined) {
|
77
|
+
'use strict';
|
78
|
+
|
79
|
+
window.Foundation = {
|
80
|
+
name : 'Foundation',
|
81
|
+
|
82
|
+
version : '4.0.0',
|
83
|
+
|
84
|
+
// global Foundation cache object
|
85
|
+
cache : {},
|
86
|
+
|
87
|
+
init : function (scope, libraries, method, options, response, /* internal */ nc) {
|
88
|
+
var library_arr,
|
89
|
+
args = [scope, method, options, response],
|
90
|
+
responses = [],
|
91
|
+
nc = nc || false;
|
92
|
+
|
93
|
+
// disable library error catching,
|
94
|
+
// used for development only
|
95
|
+
if (nc) this.nc = nc;
|
96
|
+
|
97
|
+
// set foundation global scope
|
98
|
+
this.scope = scope || this.scope;
|
99
|
+
|
100
|
+
if (libraries && typeof libraries === 'string') {
|
101
|
+
if (/off/i.test(libraries)) return this.off();
|
102
|
+
|
103
|
+
library_arr = libraries.split(' ');
|
104
|
+
|
105
|
+
if (library_arr.length > 0) {
|
106
|
+
for (var i = library_arr.length - 1; i >= 0; i--) {
|
107
|
+
responses.push(this.init_lib(library_arr[i], args));
|
108
|
+
}
|
109
|
+
}
|
110
|
+
} else {
|
111
|
+
for (var lib in this.libs) {
|
112
|
+
responses.push(this.init_lib(lib, args));
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
116
|
+
// if first argument is callback, add to args
|
117
|
+
if (typeof libraries === 'function') {
|
118
|
+
args.unshift(libraries);
|
119
|
+
}
|
120
|
+
|
121
|
+
return this.response_obj(responses, args);
|
122
|
+
},
|
123
|
+
|
124
|
+
response_obj : function (response_arr, args) {
|
125
|
+
for (var callback in args) {
|
126
|
+
if (typeof args[callback] === 'function') {
|
127
|
+
return args[callback]({
|
128
|
+
errors: response_arr.filter(function (s) {
|
129
|
+
if (typeof s === 'string') return s;
|
130
|
+
})
|
131
|
+
});
|
132
|
+
}
|
133
|
+
}
|
134
|
+
|
135
|
+
return response_arr;
|
136
|
+
},
|
137
|
+
|
138
|
+
init_lib : function (lib, args) {
|
139
|
+
return this.trap(function () {
|
140
|
+
if (this.libs.hasOwnProperty(lib)) {
|
141
|
+
this.patch(this.libs[lib]);
|
142
|
+
return this.libs[lib].init.apply(this.libs[lib], args);
|
143
|
+
}
|
144
|
+
}.bind(this), lib);
|
145
|
+
},
|
146
|
+
|
147
|
+
trap : function (fun, lib) {
|
148
|
+
if (!this.nc) {
|
149
|
+
try {
|
150
|
+
return fun();
|
151
|
+
} catch (e) {
|
152
|
+
return this.error({name: lib, message: 'could not be initialized', more: e.name + ' ' + e.message});
|
153
|
+
}
|
154
|
+
}
|
155
|
+
|
156
|
+
return fun();
|
157
|
+
},
|
158
|
+
|
159
|
+
patch : function (lib) {
|
160
|
+
this.fix_outer(lib);
|
161
|
+
},
|
162
|
+
|
163
|
+
inherit : function (scope, methods) {
|
164
|
+
var methods_arr = methods.split(' ');
|
165
|
+
|
166
|
+
for (var i = methods_arr.length - 1; i >= 0; i--) {
|
167
|
+
if (this.lib_methods.hasOwnProperty(methods_arr[i])) {
|
168
|
+
this.libs[scope.name][methods_arr[i]] = this.lib_methods[methods_arr[i]];
|
169
|
+
}
|
170
|
+
}
|
171
|
+
},
|
172
|
+
|
173
|
+
libs : {},
|
174
|
+
|
175
|
+
// methods that can be inherited in libraries
|
176
|
+
lib_methods : {
|
177
|
+
set_data : function (node, data) {
|
178
|
+
// this.name references the name of the library calling this method
|
179
|
+
var id = this.name + (+new Date());
|
180
|
+
|
181
|
+
Foundation.cache[id] = data;
|
182
|
+
node.attr('data-' + this.name + '-id', id);
|
183
|
+
},
|
184
|
+
|
185
|
+
get_data : function (node) {
|
186
|
+
return Foundation.cache[node.attr('data-' + this.name + '-id')];
|
187
|
+
},
|
188
|
+
|
189
|
+
remove_data : function (node) {
|
190
|
+
if (node) {
|
191
|
+
delete Foundation.cache[node.attr('data-' + this.name + '-id')];
|
192
|
+
node.attr('data-' + this.name + '-id', '');
|
193
|
+
} else {
|
194
|
+
$('[data-' + this.name + '-id]').each(function () {
|
195
|
+
delete Foundation.cache[$(this).attr('data-' + this.name + '-id')];
|
196
|
+
$(this).attr('data-' + this.name + '-id', '');
|
197
|
+
});
|
198
|
+
}
|
199
|
+
},
|
200
|
+
|
201
|
+
throttle : function(fun, delay) {
|
202
|
+
var timer = null;
|
203
|
+
return function () {
|
204
|
+
var context = this, args = arguments;
|
205
|
+
clearTimeout(timer);
|
206
|
+
timer = setTimeout(function () {
|
207
|
+
fun.apply(context, args);
|
208
|
+
}, delay);
|
209
|
+
};
|
210
|
+
},
|
211
|
+
|
212
|
+
// parses dat-options attribute on page nodes and turns
|
213
|
+
// them into an object
|
214
|
+
data_options : function (el) {
|
215
|
+
var opts = {}, ii, p,
|
216
|
+
opts_arr = (el.attr('data-options') || ':').split(';'),
|
217
|
+
opts_len = opts_arr.length;
|
218
|
+
|
219
|
+
function trim(str) {
|
220
|
+
if (typeof str === 'string') return $.trim(str);
|
221
|
+
return str;
|
222
|
+
}
|
223
|
+
|
224
|
+
// parse options
|
225
|
+
for (ii = opts_len - 1; ii >= 0; ii--) {
|
226
|
+
p = opts_arr[ii].split(':');
|
227
|
+
|
228
|
+
if (/true/i.test(p[1])) p[1] = true;
|
229
|
+
if (/false/i.test(p[1])) p[1] = false;
|
230
|
+
|
231
|
+
if (p.length === 2) {
|
232
|
+
opts[trim(p[0])] = trim(p[1]);
|
233
|
+
}
|
234
|
+
}
|
235
|
+
|
236
|
+
return opts;
|
237
|
+
},
|
238
|
+
|
239
|
+
delay : function (fun, delay) {
|
240
|
+
return setTimeout(fun, delay);
|
241
|
+
},
|
242
|
+
|
243
|
+
// animated scrolling
|
244
|
+
scrollTo : function (el, to, duration) {
|
245
|
+
if (duration < 0) return;
|
246
|
+
var difference = to - $(window).scrollTop();
|
247
|
+
var perTick = difference / duration * 10;
|
248
|
+
|
249
|
+
this.scrollToTimerCache = setTimeout(function() {
|
250
|
+
if (!isNaN(parseInt(perTick, 10))) {
|
251
|
+
window.scrollTo(0, $(window).scrollTop() + perTick);
|
252
|
+
this.scrollTo(el, to, duration - 10);
|
253
|
+
}
|
254
|
+
}.bind(this), 10);
|
255
|
+
},
|
256
|
+
|
257
|
+
// not supported in core Zepto
|
258
|
+
scrollLeft : function (el) {
|
259
|
+
if (!el.length) return;
|
260
|
+
return ('scrollLeft' in el[0]) ? el[0].scrollLeft : el[0].pageXOffset;
|
261
|
+
},
|
262
|
+
|
263
|
+
// test for empty object or array
|
264
|
+
empty : function (obj) {
|
265
|
+
if (obj.length && obj.length > 0) return false;
|
266
|
+
if (obj.length && obj.length === 0) return true;
|
267
|
+
|
268
|
+
for (var key in obj) {
|
269
|
+
if (hasOwnProperty.call(obj, key)) return false;
|
270
|
+
}
|
271
|
+
|
272
|
+
return true;
|
273
|
+
}
|
274
|
+
},
|
275
|
+
|
276
|
+
fix_outer : function (lib) {
|
277
|
+
lib.outerHeight = function (el, bool) {
|
278
|
+
if (typeof Zepto === 'function') {
|
279
|
+
return el.height();
|
280
|
+
}
|
281
|
+
|
282
|
+
if (typeof bool !== 'undefined') {
|
283
|
+
return el.outerHeight(bool);
|
284
|
+
}
|
285
|
+
|
286
|
+
return el.outerHeight();
|
287
|
+
};
|
288
|
+
|
289
|
+
lib.outerWidth = function (el) {
|
290
|
+
if (typeof Zepto === 'function') {
|
291
|
+
return el.width();
|
292
|
+
}
|
293
|
+
|
294
|
+
if (typeof bool !== 'undefined') {
|
295
|
+
return el.outerWidth(bool);
|
296
|
+
}
|
297
|
+
|
298
|
+
return el.outerWidth();
|
299
|
+
};
|
300
|
+
},
|
301
|
+
|
302
|
+
error : function (error) {
|
303
|
+
return error.name + ' ' + error.message + '; ' + error.more;
|
304
|
+
},
|
305
|
+
|
306
|
+
// remove all foundation events.
|
307
|
+
off: function () {
|
308
|
+
$(this.scope).off('.fndtn');
|
309
|
+
$(window).off('.fndtn');
|
310
|
+
return true;
|
311
|
+
},
|
312
|
+
|
313
|
+
zj : function () {
|
314
|
+
try {
|
315
|
+
return Zepto;
|
316
|
+
} catch (e) {
|
317
|
+
return jQuery;
|
318
|
+
}
|
319
|
+
}()
|
320
|
+
},
|
321
|
+
|
322
|
+
$.fn.foundation = function () {
|
323
|
+
var args = Array.prototype.slice.call(arguments, 0);
|
324
|
+
|
325
|
+
return this.each(function () {
|
326
|
+
Foundation.init.apply(Foundation, [this].concat(args));
|
327
|
+
return this;
|
328
|
+
});
|
329
|
+
};
|
330
|
+
|
331
|
+
}(this, this.document));
|
@@ -0,0 +1,130 @@
|
|
1
|
+
/*jslint unparam: true, browser: true, indent: 2 */
|
2
|
+
|
3
|
+
;(function ($, window, document, undefined) {
|
4
|
+
'use strict';
|
5
|
+
|
6
|
+
Foundation.libs.magellan = {
|
7
|
+
name : 'magellan',
|
8
|
+
|
9
|
+
version : '4.0.0',
|
10
|
+
|
11
|
+
settings : {
|
12
|
+
activeClass: 'active'
|
13
|
+
},
|
14
|
+
|
15
|
+
init : function (scope, method, options) {
|
16
|
+
this.scope = scope || this.scope;
|
17
|
+
Foundation.inherit(this, 'data_options');
|
18
|
+
|
19
|
+
if (typeof method === 'object') {
|
20
|
+
$.extend(true, this.settings, method);
|
21
|
+
}
|
22
|
+
|
23
|
+
if (typeof method != 'string') {
|
24
|
+
if (!this.settings.init) {
|
25
|
+
this.fixed_magellan = $("[data-magellan-expedition]");
|
26
|
+
this.set_threshold();
|
27
|
+
this.last_destination = $('[data-magellan-destination]').last();
|
28
|
+
this.events();
|
29
|
+
}
|
30
|
+
|
31
|
+
return this.settings.init;
|
32
|
+
} else {
|
33
|
+
return this[method].call(this, options);
|
34
|
+
}
|
35
|
+
},
|
36
|
+
|
37
|
+
events : function () {
|
38
|
+
var self = this;
|
39
|
+
$(this.scope).on('arrival.fndtn.magellan', '[data-magellan-arrival]', function (e) {
|
40
|
+
var $destination = $(this),
|
41
|
+
$expedition = $destination.closest('[data-magellan-expedition]'),
|
42
|
+
activeClass = $expedition.attr('data-magellan-active-class')
|
43
|
+
|| self.settings.activeClass;
|
44
|
+
|
45
|
+
$destination
|
46
|
+
.closest('[data-magellan-expedition]')
|
47
|
+
.find('[data-magellan-arrival]')
|
48
|
+
.not($destination)
|
49
|
+
.removeClass(activeClass);
|
50
|
+
$destination.addClass(activeClass);
|
51
|
+
});
|
52
|
+
|
53
|
+
this.fixed_magellan
|
54
|
+
.on('update-position.fndtn.magellan', function(){
|
55
|
+
var $el = $(this);
|
56
|
+
// $el.data("magellan-fixed-position","");
|
57
|
+
//$el.data("magellan-top-offset", "");
|
58
|
+
})
|
59
|
+
.trigger('update-position');
|
60
|
+
|
61
|
+
$(window)
|
62
|
+
.on('resize.fndtn.magellan', function() {
|
63
|
+
this.fixed_magellan.trigger('update-position');
|
64
|
+
}.bind(this))
|
65
|
+
|
66
|
+
.on('scroll.fndtn.magellan', function() {
|
67
|
+
var windowScrollTop = $(window).scrollTop();
|
68
|
+
self.fixed_magellan.each(function() {
|
69
|
+
var $expedition = $(this);
|
70
|
+
if (typeof $expedition.data('magellan-top-offset') === 'undefined') {
|
71
|
+
$expedition.data('magellan-top-offset', $expedition.offset().top);
|
72
|
+
}
|
73
|
+
if (typeof $expedition.data('magellan-fixed-position') === 'undefined') {
|
74
|
+
$expedition.data('magellan-fixed-position', false)
|
75
|
+
}
|
76
|
+
var fixed_position = (windowScrollTop + self.settings.threshold) > $expedition.data("magellan-top-offset");
|
77
|
+
var attr = $expedition.attr('data-magellan-top-offset');
|
78
|
+
|
79
|
+
if ($expedition.data("magellan-fixed-position") != fixed_position) {
|
80
|
+
$expedition.data("magellan-fixed-position", fixed_position);
|
81
|
+
if (fixed_position) {
|
82
|
+
$expedition.css({position:"fixed", top:0});
|
83
|
+
} else {
|
84
|
+
$expedition.css({position:"", top:""});
|
85
|
+
}
|
86
|
+
if (fixed_position && typeof attr != 'undefined' && attr != false) {
|
87
|
+
$expedition.css({position:"fixed", top:attr + "px"});
|
88
|
+
}
|
89
|
+
}
|
90
|
+
});
|
91
|
+
});
|
92
|
+
|
93
|
+
|
94
|
+
if (this.last_destination.length > 0) {
|
95
|
+
$(window).on('scroll.fndtn.magellan', function (e) {
|
96
|
+
var windowScrollTop = $(window).scrollTop(),
|
97
|
+
scrolltopPlusHeight = windowScrollTop + $(window).height(),
|
98
|
+
lastDestinationTop = Math.ceil(self.last_destination.offset().top);
|
99
|
+
|
100
|
+
$('[data-magellan-destination]').each(function () {
|
101
|
+
var $destination = $(this),
|
102
|
+
destination_name = $destination.attr('data-magellan-destination'),
|
103
|
+
topOffset = $destination.offset().top - windowScrollTop;
|
104
|
+
|
105
|
+
if (topOffset <= self.settings.threshold) {
|
106
|
+
$("[data-magellan-arrival='" + destination_name + "']").trigger('arrival');
|
107
|
+
}
|
108
|
+
// In large screens we may hit the bottom of the page and dont reach the top of the last magellan-destination, so lets force it
|
109
|
+
if (scrolltopPlusHeight >= $(self.scope).height() && lastDestinationTop > windowScrollTop && lastDestinationTop < scrolltopPlusHeight) {
|
110
|
+
$('[data-magellan-arrival]').last().trigger('arrival');
|
111
|
+
}
|
112
|
+
});
|
113
|
+
});
|
114
|
+
}
|
115
|
+
|
116
|
+
this.settings.init = true;
|
117
|
+
},
|
118
|
+
|
119
|
+
set_threshold : function () {
|
120
|
+
if (!this.settings.threshold) {
|
121
|
+
this.settings.threshold = (this.fixed_magellan.length > 0) ?
|
122
|
+
this.outerHeight(this.fixed_magellan, true) : 0;
|
123
|
+
}
|
124
|
+
},
|
125
|
+
|
126
|
+
off : function () {
|
127
|
+
$(this.scope).off('.fndtn.magellan');
|
128
|
+
}
|
129
|
+
};
|
130
|
+
}(Foundation.zj, this, this.document));
|