themepile-abstractio 1.0.2
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.
- checksums.yaml +15 -0
- data/.gitignore +28 -0
- data/.rbenv-version +1 -0
- data/CONTRIBUTING.md +53 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +136 -0
- data/Rakefile +2 -0
- data/abstractio.gemspec +18 -0
- data/js/foundation/foundation.alerts.js +50 -0
- data/js/foundation/foundation.clearing.js +516 -0
- data/js/foundation/foundation.cookie.js +74 -0
- data/js/foundation/foundation.dropdown.js +159 -0
- data/js/foundation/foundation.forms.js +516 -0
- data/js/foundation/foundation.joyride.js +842 -0
- data/js/foundation/foundation.js +403 -0
- data/js/foundation/foundation.magellan.js +130 -0
- data/js/foundation/foundation.orbit.js +373 -0
- data/js/foundation/foundation.placeholder.js +159 -0
- data/js/foundation/foundation.reveal.js +276 -0
- data/js/foundation/foundation.section.js +409 -0
- data/js/foundation/foundation.tooltips.js +206 -0
- data/js/foundation/foundation.topbar.js +252 -0
- data/js/foundation/index.js +16 -0
- data/js/vendor/custom.modernizr.js +4 -0
- data/js/vendor/jquery.js +9597 -0
- data/js/vendor/zepto.js +1884 -0
- data/lib/abstractio.rb +17 -0
- data/lib/abstractio/engine.rb +20 -0
- data/lib/abstractio/generators/USAGE +15 -0
- data/lib/abstractio/generators/install_generator.rb +54 -0
- data/lib/abstractio/generators/templates/application.html.erb +46 -0
- data/lib/abstractio/generators/templates/application.html.haml +31 -0
- data/lib/abstractio/generators/templates/application.html.slim +28 -0
- data/lib/abstractio/version.rb +3 -0
- data/lib/themepile-abstractio.rb +17 -0
- data/scss/abstractio.scss +46 -0
- data/scss/abstractio/_variables.scss +1224 -0
- data/scss/abstractio/components/_alert-boxes.scss +107 -0
- data/scss/abstractio/components/_block-grid.scss +68 -0
- data/scss/abstractio/components/_breadcrumbs.scss +125 -0
- data/scss/abstractio/components/_button-groups.scss +89 -0
- data/scss/abstractio/components/_buttons.scss +227 -0
- data/scss/abstractio/components/_clearing.scss +224 -0
- data/scss/abstractio/components/_custom-forms.scss +263 -0
- data/scss/abstractio/components/_dropdown-buttons.scss +115 -0
- data/scss/abstractio/components/_dropdown.scss +150 -0
- data/scss/abstractio/components/_flex-video.scss +46 -0
- data/scss/abstractio/components/_forms.scss +362 -0
- data/scss/abstractio/components/_global.scss +280 -0
- data/scss/abstractio/components/_grid.scss +186 -0
- data/scss/abstractio/components/_inline-lists.scss +53 -0
- data/scss/abstractio/components/_joyride.scss +215 -0
- data/scss/abstractio/components/_keystrokes.scss +57 -0
- data/scss/abstractio/components/_labels.scss +85 -0
- data/scss/abstractio/components/_magellan.scss +23 -0
- data/scss/abstractio/components/_orbit.scss +213 -0
- data/scss/abstractio/components/_pagination.scss +100 -0
- data/scss/abstractio/components/_panels.scss +77 -0
- data/scss/abstractio/components/_pricing-tables.scss +131 -0
- data/scss/abstractio/components/_progress-bars.scss +71 -0
- data/scss/abstractio/components/_reveal.scss +132 -0
- data/scss/abstractio/components/_section.scss +318 -0
- data/scss/abstractio/components/_side-nav.scss +69 -0
- data/scss/abstractio/components/_split-buttons.scss +167 -0
- data/scss/abstractio/components/_sub-nav.scss +68 -0
- data/scss/abstractio/components/_switch.scss +251 -0
- data/scss/abstractio/components/_tables.scss +84 -0
- data/scss/abstractio/components/_thumbs.scss +48 -0
- data/scss/abstractio/components/_tooltips.scss +117 -0
- data/scss/abstractio/components/_top-bar.scss +495 -0
- data/scss/abstractio/components/_type.scss +426 -0
- data/scss/abstractio/components/_visibility.scss +322 -0
- data/scss/normalize.scss +402 -0
- data/templates/project/.gitignore +44 -0
- data/templates/project/MIT-LICENSE.txt +20 -0
- data/templates/project/config.rb +26 -0
- data/templates/project/humans.txt +8 -0
- data/templates/project/index.html +124 -0
- data/templates/project/manifest.rb +45 -0
- data/templates/project/robots.txt +4 -0
- data/templates/project/scss/app.scss +48 -0
- data/templates/upgrade/manifest.rb +34 -0
- metadata +153 -0
@@ -0,0 +1,403 @@
|
|
1
|
+
/*
|
2
|
+
* Foundation Responsive Library
|
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
|
+
// Accommodate running jQuery or Zepto in noConflict() mode by
|
12
|
+
// using an anonymous function to redefine the $ shorthand name.
|
13
|
+
// See http://docs.jquery.com/Using_jQuery_with_Other_Libraries
|
14
|
+
// and http://zeptojs.com/
|
15
|
+
var libFuncName = null;
|
16
|
+
|
17
|
+
if (typeof jQuery === "undefined" &&
|
18
|
+
typeof Zepto === "undefined" &&
|
19
|
+
typeof $ === "function") {
|
20
|
+
libFuncName = $;
|
21
|
+
} else if (typeof jQuery === "function") {
|
22
|
+
libFuncName = jQuery;
|
23
|
+
} else if (typeof Zepto === "function") {
|
24
|
+
libFuncName = Zepto;
|
25
|
+
} else {
|
26
|
+
throw new TypeError();
|
27
|
+
}
|
28
|
+
|
29
|
+
(function ($, window, document, undefined) {
|
30
|
+
'use strict';
|
31
|
+
|
32
|
+
// add dusty browser stuff
|
33
|
+
if (!Array.prototype.filter) {
|
34
|
+
Array.prototype.filter = function(fun /*, thisp */) {
|
35
|
+
"use strict";
|
36
|
+
|
37
|
+
if (this == null) {
|
38
|
+
throw new TypeError();
|
39
|
+
}
|
40
|
+
|
41
|
+
var t = Object(this),
|
42
|
+
len = t.length >>> 0;
|
43
|
+
if (typeof fun != "function") {
|
44
|
+
return;
|
45
|
+
}
|
46
|
+
|
47
|
+
var res = [],
|
48
|
+
thisp = arguments[1];
|
49
|
+
for (var i = 0; i < len; i++) {
|
50
|
+
if (i in t) {
|
51
|
+
var val = t[i]; // in case fun mutates this
|
52
|
+
if (fun && fun.call(thisp, val, i, t)) {
|
53
|
+
res.push(val);
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
return res;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
if (!Function.prototype.bind) {
|
63
|
+
Function.prototype.bind = function (oThis) {
|
64
|
+
if (typeof this !== "function") {
|
65
|
+
// closest thing possible to the ECMAScript 5 internal IsCallable function
|
66
|
+
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
|
67
|
+
}
|
68
|
+
|
69
|
+
var aArgs = Array.prototype.slice.call(arguments, 1),
|
70
|
+
fToBind = this,
|
71
|
+
fNOP = function () {},
|
72
|
+
fBound = function () {
|
73
|
+
return fToBind.apply(this instanceof fNOP && oThis
|
74
|
+
? this
|
75
|
+
: oThis,
|
76
|
+
aArgs.concat(Array.prototype.slice.call(arguments)));
|
77
|
+
};
|
78
|
+
|
79
|
+
fNOP.prototype = this.prototype;
|
80
|
+
fBound.prototype = new fNOP();
|
81
|
+
|
82
|
+
return fBound;
|
83
|
+
};
|
84
|
+
}
|
85
|
+
|
86
|
+
if (!Array.prototype.indexOf) {
|
87
|
+
Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
|
88
|
+
"use strict";
|
89
|
+
if (this == null) {
|
90
|
+
throw new TypeError();
|
91
|
+
}
|
92
|
+
var t = Object(this);
|
93
|
+
var len = t.length >>> 0;
|
94
|
+
if (len === 0) {
|
95
|
+
return -1;
|
96
|
+
}
|
97
|
+
var n = 0;
|
98
|
+
if (arguments.length > 1) {
|
99
|
+
n = Number(arguments[1]);
|
100
|
+
if (n != n) { // shortcut for verifying if it's NaN
|
101
|
+
n = 0;
|
102
|
+
} else if (n != 0 && n != Infinity && n != -Infinity) {
|
103
|
+
n = (n > 0 || -1) * Math.floor(Math.abs(n));
|
104
|
+
}
|
105
|
+
}
|
106
|
+
if (n >= len) {
|
107
|
+
return -1;
|
108
|
+
}
|
109
|
+
var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);
|
110
|
+
for (; k < len; k++) {
|
111
|
+
if (k in t && t[k] === searchElement) {
|
112
|
+
return k;
|
113
|
+
}
|
114
|
+
}
|
115
|
+
return -1;
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
// fake stop() for zepto.
|
120
|
+
$.fn.stop = $.fn.stop || function() {
|
121
|
+
return this;
|
122
|
+
};
|
123
|
+
|
124
|
+
window.Foundation = {
|
125
|
+
name : 'Foundation',
|
126
|
+
|
127
|
+
version : '4.1.5',
|
128
|
+
|
129
|
+
cache : {},
|
130
|
+
|
131
|
+
init : function (scope, libraries, method, options, response, /* internal */ nc) {
|
132
|
+
var library_arr,
|
133
|
+
args = [scope, method, options, response],
|
134
|
+
responses = [],
|
135
|
+
nc = nc || false;
|
136
|
+
|
137
|
+
// disable library error catching,
|
138
|
+
// used for development only
|
139
|
+
if (nc) this.nc = nc;
|
140
|
+
|
141
|
+
// check RTL
|
142
|
+
this.rtl = /rtl/i.test($('html').attr('dir'));
|
143
|
+
|
144
|
+
// set foundation global scope
|
145
|
+
this.scope = scope || this.scope;
|
146
|
+
|
147
|
+
if (libraries && typeof libraries === 'string') {
|
148
|
+
if (/off/i.test(libraries)) return this.off();
|
149
|
+
|
150
|
+
library_arr = libraries.split(' ');
|
151
|
+
|
152
|
+
if (library_arr.length > 0) {
|
153
|
+
for (var i = library_arr.length - 1; i >= 0; i--) {
|
154
|
+
responses.push(this.init_lib(library_arr[i], args));
|
155
|
+
}
|
156
|
+
}
|
157
|
+
} else {
|
158
|
+
for (var lib in this.libs) {
|
159
|
+
responses.push(this.init_lib(lib, args));
|
160
|
+
}
|
161
|
+
}
|
162
|
+
|
163
|
+
// if first argument is callback, add to args
|
164
|
+
if (typeof libraries === 'function') {
|
165
|
+
args.unshift(libraries);
|
166
|
+
}
|
167
|
+
|
168
|
+
return this.response_obj(responses, args);
|
169
|
+
},
|
170
|
+
|
171
|
+
response_obj : function (response_arr, args) {
|
172
|
+
for (var i = 0, len = args.length; i < len; i++) {
|
173
|
+
if (typeof args[i] === 'function') {
|
174
|
+
return args[i]({
|
175
|
+
errors: response_arr.filter(function (s) {
|
176
|
+
if (typeof s === 'string') return s;
|
177
|
+
})
|
178
|
+
});
|
179
|
+
}
|
180
|
+
}
|
181
|
+
|
182
|
+
return response_arr;
|
183
|
+
},
|
184
|
+
|
185
|
+
init_lib : function (lib, args) {
|
186
|
+
return this.trap(function () {
|
187
|
+
if (this.libs.hasOwnProperty(lib)) {
|
188
|
+
this.patch(this.libs[lib]);
|
189
|
+
return this.libs[lib].init.apply(this.libs[lib], args);
|
190
|
+
}
|
191
|
+
else {
|
192
|
+
return function () {};
|
193
|
+
}
|
194
|
+
}.bind(this), lib);
|
195
|
+
},
|
196
|
+
|
197
|
+
trap : function (fun, lib) {
|
198
|
+
if (!this.nc) {
|
199
|
+
try {
|
200
|
+
return fun();
|
201
|
+
} catch (e) {
|
202
|
+
return this.error({name: lib, message: 'could not be initialized', more: e.name + ' ' + e.message});
|
203
|
+
}
|
204
|
+
}
|
205
|
+
|
206
|
+
return fun();
|
207
|
+
},
|
208
|
+
|
209
|
+
patch : function (lib) {
|
210
|
+
this.fix_outer(lib);
|
211
|
+
lib.scope = this.scope;
|
212
|
+
lib.rtl = this.rtl;
|
213
|
+
},
|
214
|
+
|
215
|
+
inherit : function (scope, methods) {
|
216
|
+
var methods_arr = methods.split(' ');
|
217
|
+
|
218
|
+
for (var i = methods_arr.length - 1; i >= 0; i--) {
|
219
|
+
if (this.lib_methods.hasOwnProperty(methods_arr[i])) {
|
220
|
+
this.libs[scope.name][methods_arr[i]] = this.lib_methods[methods_arr[i]];
|
221
|
+
}
|
222
|
+
}
|
223
|
+
},
|
224
|
+
|
225
|
+
random_str : function (length) {
|
226
|
+
var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz'.split('');
|
227
|
+
|
228
|
+
if (!length) {
|
229
|
+
length = Math.floor(Math.random() * chars.length);
|
230
|
+
}
|
231
|
+
|
232
|
+
var str = '';
|
233
|
+
for (var i = 0; i < length; i++) {
|
234
|
+
str += chars[Math.floor(Math.random() * chars.length)];
|
235
|
+
}
|
236
|
+
return str;
|
237
|
+
},
|
238
|
+
|
239
|
+
libs : {},
|
240
|
+
|
241
|
+
// methods that can be inherited in libraries
|
242
|
+
lib_methods : {
|
243
|
+
set_data : function (node, data) {
|
244
|
+
// this.name references the name of the library calling this method
|
245
|
+
var id = [this.name,+new Date(),Foundation.random_str(5)].join('-');
|
246
|
+
|
247
|
+
Foundation.cache[id] = data;
|
248
|
+
node.attr('data-' + this.name + '-id', id);
|
249
|
+
return data;
|
250
|
+
},
|
251
|
+
|
252
|
+
get_data : function (node) {
|
253
|
+
return Foundation.cache[node.attr('data-' + this.name + '-id')];
|
254
|
+
},
|
255
|
+
|
256
|
+
remove_data : function (node) {
|
257
|
+
if (node) {
|
258
|
+
delete Foundation.cache[node.attr('data-' + this.name + '-id')];
|
259
|
+
node.attr('data-' + this.name + '-id', '');
|
260
|
+
} else {
|
261
|
+
$('[data-' + this.name + '-id]').each(function () {
|
262
|
+
delete Foundation.cache[$(this).attr('data-' + this.name + '-id')];
|
263
|
+
$(this).attr('data-' + this.name + '-id', '');
|
264
|
+
});
|
265
|
+
}
|
266
|
+
},
|
267
|
+
|
268
|
+
throttle : function(fun, delay) {
|
269
|
+
var timer = null;
|
270
|
+
return function () {
|
271
|
+
var context = this, args = arguments;
|
272
|
+
clearTimeout(timer);
|
273
|
+
timer = setTimeout(function () {
|
274
|
+
fun.apply(context, args);
|
275
|
+
}, delay);
|
276
|
+
};
|
277
|
+
},
|
278
|
+
|
279
|
+
// parses data-options attribute on nodes and turns
|
280
|
+
// them into an object
|
281
|
+
data_options : function (el) {
|
282
|
+
var opts = {}, ii, p,
|
283
|
+
opts_arr = (el.attr('data-options') || ':').split(';'),
|
284
|
+
opts_len = opts_arr.length;
|
285
|
+
|
286
|
+
function isNumber (o) {
|
287
|
+
return ! isNaN (o-0) && o !== null && o !== "" && o !== false && o !== true;
|
288
|
+
}
|
289
|
+
|
290
|
+
function trim(str) {
|
291
|
+
if (typeof str === 'string') return $.trim(str);
|
292
|
+
return str;
|
293
|
+
}
|
294
|
+
|
295
|
+
// parse options
|
296
|
+
for (ii = opts_len - 1; ii >= 0; ii--) {
|
297
|
+
p = opts_arr[ii].split(':');
|
298
|
+
|
299
|
+
if (/true/i.test(p[1])) p[1] = true;
|
300
|
+
if (/false/i.test(p[1])) p[1] = false;
|
301
|
+
if (isNumber(p[1])) p[1] = parseInt(p[1], 10);
|
302
|
+
|
303
|
+
if (p.length === 2 && p[0].length > 0) {
|
304
|
+
opts[trim(p[0])] = trim(p[1]);
|
305
|
+
}
|
306
|
+
}
|
307
|
+
|
308
|
+
return opts;
|
309
|
+
},
|
310
|
+
|
311
|
+
delay : function (fun, delay) {
|
312
|
+
return setTimeout(fun, delay);
|
313
|
+
},
|
314
|
+
|
315
|
+
// animated scrolling
|
316
|
+
scrollTo : function (el, to, duration) {
|
317
|
+
if (duration < 0) return;
|
318
|
+
var difference = to - $(window).scrollTop();
|
319
|
+
var perTick = difference / duration * 10;
|
320
|
+
|
321
|
+
this.scrollToTimerCache = setTimeout(function() {
|
322
|
+
if (!isNaN(parseInt(perTick, 10))) {
|
323
|
+
window.scrollTo(0, $(window).scrollTop() + perTick);
|
324
|
+
this.scrollTo(el, to, duration - 10);
|
325
|
+
}
|
326
|
+
}.bind(this), 10);
|
327
|
+
},
|
328
|
+
|
329
|
+
// not supported in core Zepto
|
330
|
+
scrollLeft : function (el) {
|
331
|
+
if (!el.length) return;
|
332
|
+
return ('scrollLeft' in el[0]) ? el[0].scrollLeft : el[0].pageXOffset;
|
333
|
+
},
|
334
|
+
|
335
|
+
// test for empty object or array
|
336
|
+
empty : function (obj) {
|
337
|
+
if (obj.length && obj.length > 0) return false;
|
338
|
+
if (obj.length && obj.length === 0) return true;
|
339
|
+
|
340
|
+
for (var key in obj) {
|
341
|
+
if (hasOwnProperty.call(obj, key)) return false;
|
342
|
+
}
|
343
|
+
|
344
|
+
return true;
|
345
|
+
}
|
346
|
+
},
|
347
|
+
|
348
|
+
fix_outer : function (lib) {
|
349
|
+
lib.outerHeight = function (el, bool) {
|
350
|
+
if (typeof Zepto === 'function') {
|
351
|
+
return el.height();
|
352
|
+
}
|
353
|
+
|
354
|
+
if (typeof bool !== 'undefined') {
|
355
|
+
return el.outerHeight(bool);
|
356
|
+
}
|
357
|
+
|
358
|
+
return el.outerHeight();
|
359
|
+
};
|
360
|
+
|
361
|
+
lib.outerWidth = function (el) {
|
362
|
+
if (typeof Zepto === 'function') {
|
363
|
+
return el.width();
|
364
|
+
}
|
365
|
+
|
366
|
+
if (typeof bool !== 'undefined') {
|
367
|
+
return el.outerWidth(bool);
|
368
|
+
}
|
369
|
+
|
370
|
+
return el.outerWidth();
|
371
|
+
};
|
372
|
+
},
|
373
|
+
|
374
|
+
error : function (error) {
|
375
|
+
return error.name + ' ' + error.message + '; ' + error.more;
|
376
|
+
},
|
377
|
+
|
378
|
+
// remove all foundation events.
|
379
|
+
off: function () {
|
380
|
+
$(this.scope).off('.fndtn');
|
381
|
+
$(window).off('.fndtn');
|
382
|
+
return true;
|
383
|
+
},
|
384
|
+
|
385
|
+
zj : function () {
|
386
|
+
try {
|
387
|
+
return Zepto;
|
388
|
+
} catch (e) {
|
389
|
+
return jQuery;
|
390
|
+
}
|
391
|
+
}()
|
392
|
+
};
|
393
|
+
|
394
|
+
$.fn.foundation = function () {
|
395
|
+
var args = Array.prototype.slice.call(arguments, 0);
|
396
|
+
|
397
|
+
return this.each(function () {
|
398
|
+
Foundation.init.apply(Foundation, [this].concat(args));
|
399
|
+
return this;
|
400
|
+
});
|
401
|
+
};
|
402
|
+
|
403
|
+
}(libFuncName, 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));
|