va_common 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -4
  3. data/app/assets/js/va_common_main.js +16 -1
  4. data/lib/va_common/version.rb +1 -1
  5. data/lib/va_common.rb +4 -0
  6. data/va_common.gemspec +15 -0
  7. metadata +200 -177
  8. data/app/assets/js/foundation/foundation.abide.js +0 -408
  9. data/app/assets/js/foundation/foundation.accordion.js +0 -88
  10. data/app/assets/js/foundation/foundation.alert.js +0 -43
  11. data/app/assets/js/foundation/foundation.clearing.js +0 -586
  12. data/app/assets/js/foundation/foundation.dropdown.js +0 -463
  13. data/app/assets/js/foundation/foundation.equalizer.js +0 -104
  14. data/app/assets/js/foundation/foundation.interchange.js +0 -359
  15. data/app/assets/js/foundation/foundation.joyride.js +0 -932
  16. data/app/assets/js/foundation/foundation.js +0 -725
  17. data/app/assets/js/foundation/foundation.magellan.js +0 -215
  18. data/app/assets/js/foundation/foundation.offcanvas.js +0 -152
  19. data/app/assets/js/foundation/foundation.orbit.js +0 -476
  20. data/app/assets/js/foundation/foundation.reveal.js +0 -498
  21. data/app/assets/js/foundation/foundation.slider.js +0 -281
  22. data/app/assets/js/foundation/foundation.tab.js +0 -249
  23. data/app/assets/js/foundation/foundation.tooltip.js +0 -339
  24. data/app/assets/js/foundation/foundation.topbar.js +0 -458
  25. data/app/assets/js/foundation.min.js +0 -6376
  26. data/app/assets/js/vendor/html5shiv.js +0 -8
  27. data/app/assets/js/vendor/jquery-1.11.0.min.js +0 -4
  28. data/app/assets/js/vendor/jquery.js +0 -9789
  29. data/app/assets/js/vendor/jquery.smooth-scroll.js +0 -255
  30. data/app/assets/js/vendor/jquery.stellar.js +0 -651
  31. data/app/assets/js/vendor/jquery.tipsy.js +0 -258
  32. data/app/assets/js/vendor/menu.js +0 -40
  33. data/app/assets/js/vendor/modernizr.custom.js +0 -4
  34. data/app/assets/js/vendor/respond.min.js +0 -6
  35. data/app/assets/js/vendor/selectivizr-1.0.3b.js +0 -560
  36. data/app/assets/js/vendor/tota11y.min.js +0 -28
  37. data/app/assets/js/vendor/wow.min.js +0 -2
  38. data/app/assets/stylesheets/foundation/_functions.scss +0 -146
  39. data/app/assets/stylesheets/foundation/_settings.scss +0 -1467
  40. data/app/assets/stylesheets/foundation/_variables.scss +0 -1286
  41. data/app/assets/stylesheets/foundation/components/_accordion.scss +0 -157
  42. data/app/assets/stylesheets/foundation/components/_alert-boxes.scss +0 -128
  43. data/app/assets/stylesheets/foundation/components/_block-grid.scss +0 -132
  44. data/app/assets/stylesheets/foundation/components/_breadcrumbs.scss +0 -132
  45. data/app/assets/stylesheets/foundation/components/_button-groups.scss +0 -200
  46. data/app/assets/stylesheets/foundation/components/_buttons.scss +0 -259
  47. data/app/assets/stylesheets/foundation/components/_clearing.scss +0 -256
  48. data/app/assets/stylesheets/foundation/components/_dropdown-buttons.scss +0 -131
  49. data/app/assets/stylesheets/foundation/components/_dropdown.scss +0 -262
  50. data/app/assets/stylesheets/foundation/components/_flex-video.scss +0 -51
  51. data/app/assets/stylesheets/foundation/components/_forms.scss +0 -570
  52. data/app/assets/stylesheets/foundation/components/_global.scss +0 -481
  53. data/app/assets/stylesheets/foundation/components/_grid.scss +0 -289
  54. data/app/assets/stylesheets/foundation/components/_icon-bar.scss +0 -358
  55. data/app/assets/stylesheets/foundation/components/_inline-lists.scss +0 -57
  56. data/app/assets/stylesheets/foundation/components/_joyride.scss +0 -222
  57. data/app/assets/stylesheets/foundation/components/_keystrokes.scss +0 -61
  58. data/app/assets/stylesheets/foundation/components/_labels.scss +0 -106
  59. data/app/assets/stylesheets/foundation/components/_magellan.scss +0 -34
  60. data/app/assets/stylesheets/foundation/components/_offcanvas.scss +0 -515
  61. data/app/assets/stylesheets/foundation/components/_orbit.scss +0 -368
  62. data/app/assets/stylesheets/foundation/components/_pagination.scss +0 -162
  63. data/app/assets/stylesheets/foundation/components/_panels.scss +0 -101
  64. data/app/assets/stylesheets/foundation/components/_pricing-tables.scss +0 -150
  65. data/app/assets/stylesheets/foundation/components/_progress-bars.scss +0 -79
  66. data/app/assets/stylesheets/foundation/components/_range-slider.scss +0 -169
  67. data/app/assets/stylesheets/foundation/components/_reveal.scss +0 -202
  68. data/app/assets/stylesheets/foundation/components/_side-nav.scss +0 -116
  69. data/app/assets/stylesheets/foundation/components/_split-buttons.scss +0 -199
  70. data/app/assets/stylesheets/foundation/components/_sub-nav.scss +0 -123
  71. data/app/assets/stylesheets/foundation/components/_switches.scss +0 -238
  72. data/app/assets/stylesheets/foundation/components/_tables.scss +0 -135
  73. data/app/assets/stylesheets/foundation/components/_tabs.scss +0 -123
  74. data/app/assets/stylesheets/foundation/components/_thumbs.scss +0 -66
  75. data/app/assets/stylesheets/foundation/components/_toolbar.scss +0 -70
  76. data/app/assets/stylesheets/foundation/components/_tooltips.scss +0 -142
  77. data/app/assets/stylesheets/foundation/components/_top-bar.scss +0 -691
  78. data/app/assets/stylesheets/foundation/components/_type.scss +0 -525
  79. data/app/assets/stylesheets/foundation/components/_visibility.scss +0 -408
  80. data/app/assets/stylesheets/lib/_normalize.scss +0 -427
  81. data/app/assets/stylesheets/lib/bourbon/_bourbon-deprecated-upcoming.scss +0 -411
  82. data/app/assets/stylesheets/lib/bourbon/_bourbon.scss +0 -87
  83. data/app/assets/stylesheets/lib/bourbon/addons/_border-color.scss +0 -26
  84. data/app/assets/stylesheets/lib/bourbon/addons/_border-radius.scss +0 -48
  85. data/app/assets/stylesheets/lib/bourbon/addons/_border-style.scss +0 -25
  86. data/app/assets/stylesheets/lib/bourbon/addons/_border-width.scss +0 -25
  87. data/app/assets/stylesheets/lib/bourbon/addons/_buttons.scss +0 -64
  88. data/app/assets/stylesheets/lib/bourbon/addons/_clearfix.scss +0 -25
  89. data/app/assets/stylesheets/lib/bourbon/addons/_ellipsis.scss +0 -30
  90. data/app/assets/stylesheets/lib/bourbon/addons/_font-stacks.scss +0 -31
  91. data/app/assets/stylesheets/lib/bourbon/addons/_hide-text.scss +0 -27
  92. data/app/assets/stylesheets/lib/bourbon/addons/_margin.scss +0 -26
  93. data/app/assets/stylesheets/lib/bourbon/addons/_padding.scss +0 -26
  94. data/app/assets/stylesheets/lib/bourbon/addons/_position.scss +0 -48
  95. data/app/assets/stylesheets/lib/bourbon/addons/_prefixer.scss +0 -66
  96. data/app/assets/stylesheets/lib/bourbon/addons/_retina-image.scss +0 -25
  97. data/app/assets/stylesheets/lib/bourbon/addons/_size.scss +0 -51
  98. data/app/assets/stylesheets/lib/bourbon/addons/_text-inputs.scss +0 -112
  99. data/app/assets/stylesheets/lib/bourbon/addons/_timing-functions.scss +0 -34
  100. data/app/assets/stylesheets/lib/bourbon/addons/_triangle.scss +0 -63
  101. data/app/assets/stylesheets/lib/bourbon/addons/_word-wrap.scss +0 -29
  102. data/app/assets/stylesheets/lib/bourbon/css3/_animation.scss +0 -43
  103. data/app/assets/stylesheets/lib/bourbon/css3/_appearance.scss +0 -3
  104. data/app/assets/stylesheets/lib/bourbon/css3/_backface-visibility.scss +0 -3
  105. data/app/assets/stylesheets/lib/bourbon/css3/_background-image.scss +0 -42
  106. data/app/assets/stylesheets/lib/bourbon/css3/_background.scss +0 -55
  107. data/app/assets/stylesheets/lib/bourbon/css3/_border-image.scss +0 -59
  108. data/app/assets/stylesheets/lib/bourbon/css3/_calc.scss +0 -4
  109. data/app/assets/stylesheets/lib/bourbon/css3/_columns.scss +0 -47
  110. data/app/assets/stylesheets/lib/bourbon/css3/_filter.scss +0 -4
  111. data/app/assets/stylesheets/lib/bourbon/css3/_flex-box.scss +0 -287
  112. data/app/assets/stylesheets/lib/bourbon/css3/_font-face.scss +0 -24
  113. data/app/assets/stylesheets/lib/bourbon/css3/_font-feature-settings.scss +0 -4
  114. data/app/assets/stylesheets/lib/bourbon/css3/_hidpi-media-query.scss +0 -10
  115. data/app/assets/stylesheets/lib/bourbon/css3/_hyphens.scss +0 -4
  116. data/app/assets/stylesheets/lib/bourbon/css3/_image-rendering.scss +0 -14
  117. data/app/assets/stylesheets/lib/bourbon/css3/_keyframes.scss +0 -36
  118. data/app/assets/stylesheets/lib/bourbon/css3/_linear-gradient.scss +0 -38
  119. data/app/assets/stylesheets/lib/bourbon/css3/_perspective.scss +0 -8
  120. data/app/assets/stylesheets/lib/bourbon/css3/_placeholder.scss +0 -8
  121. data/app/assets/stylesheets/lib/bourbon/css3/_radial-gradient.scss +0 -39
  122. data/app/assets/stylesheets/lib/bourbon/css3/_selection.scss +0 -42
  123. data/app/assets/stylesheets/lib/bourbon/css3/_text-decoration.scss +0 -19
  124. data/app/assets/stylesheets/lib/bourbon/css3/_transform.scss +0 -15
  125. data/app/assets/stylesheets/lib/bourbon/css3/_transition.scss +0 -71
  126. data/app/assets/stylesheets/lib/bourbon/css3/_user-select.scss +0 -3
  127. data/app/assets/stylesheets/lib/bourbon/functions/_assign-inputs.scss +0 -11
  128. data/app/assets/stylesheets/lib/bourbon/functions/_contains-falsy.scss +0 -20
  129. data/app/assets/stylesheets/lib/bourbon/functions/_contains.scss +0 -26
  130. data/app/assets/stylesheets/lib/bourbon/functions/_is-length.scss +0 -11
  131. data/app/assets/stylesheets/lib/bourbon/functions/_is-light.scss +0 -21
  132. data/app/assets/stylesheets/lib/bourbon/functions/_is-number.scss +0 -11
  133. data/app/assets/stylesheets/lib/bourbon/functions/_is-size.scss +0 -13
  134. data/app/assets/stylesheets/lib/bourbon/functions/_modular-scale.scss +0 -69
  135. data/app/assets/stylesheets/lib/bourbon/functions/_px-to-em.scss +0 -13
  136. data/app/assets/stylesheets/lib/bourbon/functions/_px-to-rem.scss +0 -15
  137. data/app/assets/stylesheets/lib/bourbon/functions/_shade.scss +0 -24
  138. data/app/assets/stylesheets/lib/bourbon/functions/_strip-units.scss +0 -17
  139. data/app/assets/stylesheets/lib/bourbon/functions/_tint.scss +0 -24
  140. data/app/assets/stylesheets/lib/bourbon/functions/_transition-property-name.scss +0 -22
  141. data/app/assets/stylesheets/lib/bourbon/functions/_unpack.scss +0 -27
  142. data/app/assets/stylesheets/lib/bourbon/helpers/_convert-units.scss +0 -21
  143. data/app/assets/stylesheets/lib/bourbon/helpers/_directional-values.scss +0 -96
  144. data/app/assets/stylesheets/lib/bourbon/helpers/_font-source-declaration.scss +0 -43
  145. data/app/assets/stylesheets/lib/bourbon/helpers/_gradient-positions-parser.scss +0 -13
  146. data/app/assets/stylesheets/lib/bourbon/helpers/_linear-angle-parser.scss +0 -25
  147. data/app/assets/stylesheets/lib/bourbon/helpers/_linear-gradient-parser.scss +0 -41
  148. data/app/assets/stylesheets/lib/bourbon/helpers/_linear-positions-parser.scss +0 -61
  149. data/app/assets/stylesheets/lib/bourbon/helpers/_linear-side-corner-parser.scss +0 -31
  150. data/app/assets/stylesheets/lib/bourbon/helpers/_radial-arg-parser.scss +0 -69
  151. data/app/assets/stylesheets/lib/bourbon/helpers/_radial-gradient-parser.scss +0 -50
  152. data/app/assets/stylesheets/lib/bourbon/helpers/_radial-positions-parser.scss +0 -18
  153. data/app/assets/stylesheets/lib/bourbon/helpers/_render-gradients.scss +0 -26
  154. data/app/assets/stylesheets/lib/bourbon/helpers/_shape-size-stripper.scss +0 -10
  155. data/app/assets/stylesheets/lib/bourbon/helpers/_str-to-num.scss +0 -50
  156. data/app/assets/stylesheets/lib/bourbon/settings/_asset-pipeline.scss +0 -7
  157. data/app/assets/stylesheets/lib/bourbon/settings/_prefixer.scss +0 -9
  158. data/app/assets/stylesheets/lib/bourbon/settings/_px-to-em.scss +0 -1
  159. data/app/assets/stylesheets/lib/neat/_neat-helpers.scss +0 -8
  160. data/app/assets/stylesheets/lib/neat/_neat.scss +0 -23
  161. data/app/assets/stylesheets/lib/neat/functions/_new-breakpoint.scss +0 -49
  162. data/app/assets/stylesheets/lib/neat/functions/_private.scss +0 -114
  163. data/app/assets/stylesheets/lib/neat/grid/_box-sizing.scss +0 -15
  164. data/app/assets/stylesheets/lib/neat/grid/_direction-context.scss +0 -33
  165. data/app/assets/stylesheets/lib/neat/grid/_display-context.scss +0 -28
  166. data/app/assets/stylesheets/lib/neat/grid/_fill-parent.scss +0 -22
  167. data/app/assets/stylesheets/lib/neat/grid/_media.scss +0 -92
  168. data/app/assets/stylesheets/lib/neat/grid/_omega.scss +0 -87
  169. data/app/assets/stylesheets/lib/neat/grid/_outer-container.scss +0 -38
  170. data/app/assets/stylesheets/lib/neat/grid/_pad.scss +0 -25
  171. data/app/assets/stylesheets/lib/neat/grid/_private.scss +0 -35
  172. data/app/assets/stylesheets/lib/neat/grid/_row.scss +0 -52
  173. data/app/assets/stylesheets/lib/neat/grid/_shift.scss +0 -50
  174. data/app/assets/stylesheets/lib/neat/grid/_span-columns.scss +0 -94
  175. data/app/assets/stylesheets/lib/neat/grid/_to-deprecate.scss +0 -97
  176. data/app/assets/stylesheets/lib/neat/grid/_visual-grid.scss +0 -42
  177. data/app/assets/stylesheets/lib/neat/settings/_disable-warnings.scss +0 -13
  178. data/app/assets/stylesheets/lib/neat/settings/_grid.scss +0 -51
  179. data/app/assets/stylesheets/lib/neat/settings/_visual-grid.scss +0 -27
  180. data/app/assets/stylesheets/va_common_main.css.scss +0 -18
  181. /data/app/assets/js/{vendor/scroll-settings.js → scroll-settings.js} +0 -0
  182. /data/app/assets/js/{vendor/stellar-settings.js → stellar-settings.js} +0 -0
@@ -1,651 +0,0 @@
1
- ;(function($, window, document, undefined) {
2
-
3
- var pluginName = 'stellar',
4
- defaults = {
5
- scrollProperty: 'scroll',
6
- positionProperty: 'position',
7
- horizontalScrolling: true,
8
- verticalScrolling: true,
9
- horizontalOffset: 0,
10
- verticalOffset: 0,
11
- responsive: false,
12
- parallaxBackgrounds: true,
13
- parallaxElements: true,
14
- hideDistantElements: true,
15
- hideElement: function($elem) { $elem.hide(); },
16
- showElement: function($elem) { $elem.show(); }
17
- },
18
-
19
- scrollProperty = {
20
- scroll: {
21
- getLeft: function($elem) { return $elem.scrollLeft(); },
22
- setLeft: function($elem, val) { $elem.scrollLeft(val); },
23
-
24
- getTop: function($elem) { return $elem.scrollTop(); },
25
- setTop: function($elem, val) { $elem.scrollTop(val); }
26
- },
27
- position: {
28
- getLeft: function($elem) { return parseInt($elem.css('left'), 10) * -1; },
29
- getTop: function($elem) { return parseInt($elem.css('top'), 10) * -1; }
30
- },
31
- margin: {
32
- getLeft: function($elem) { return parseInt($elem.css('margin-left'), 10) * -1; },
33
- getTop: function($elem) { return parseInt($elem.css('margin-top'), 10) * -1; }
34
- },
35
- transform: {
36
- getLeft: function($elem) {
37
- var computedTransform = getComputedStyle($elem[0])[prefixedTransform];
38
- return (computedTransform !== 'none' ? parseInt(computedTransform.match(/(-?[0-9]+)/g)[4], 10) * -1 : 0);
39
- },
40
- getTop: function($elem) {
41
- var computedTransform = getComputedStyle($elem[0])[prefixedTransform];
42
- return (computedTransform !== 'none' ? parseInt(computedTransform.match(/(-?[0-9]+)/g)[5], 10) * -1 : 0);
43
- }
44
- }
45
- },
46
-
47
- positionProperty = {
48
- position: {
49
- setLeft: function($elem, left) { $elem.css('left', left); },
50
- setTop: function($elem, top) { $elem.css('top', top); }
51
- },
52
- transform: {
53
- setPosition: function($elem, left, startingLeft, top, startingTop) {
54
- $elem[0].style[prefixedTransform] = 'translate3d(' + (left - startingLeft) + 'px, ' + (top - startingTop) + 'px, 0)';
55
- }
56
- }
57
- },
58
-
59
- // Returns a function which adds a vendor prefix to any CSS property name
60
- vendorPrefix = (function() {
61
- var prefixes = /^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,
62
- style = $('script')[0].style,
63
- prefix = '',
64
- prop;
65
-
66
- for (prop in style) {
67
- if (prefixes.test(prop)) {
68
- prefix = prop.match(prefixes)[0];
69
- break;
70
- }
71
- }
72
-
73
- if ('WebkitOpacity' in style) { prefix = 'Webkit'; }
74
- if ('KhtmlOpacity' in style) { prefix = 'Khtml'; }
75
-
76
- return function(property) {
77
- return prefix + (prefix.length > 0 ? property.charAt(0).toUpperCase() + property.slice(1) : property);
78
- };
79
- }()),
80
-
81
- prefixedTransform = vendorPrefix('transform'),
82
-
83
- supportsBackgroundPositionXY = $('<div />', { style: 'background:#fff' }).css('background-position-x') !== undefined,
84
-
85
- setBackgroundPosition = (supportsBackgroundPositionXY ?
86
- function($elem, x, y) {
87
- $elem.css({
88
- 'background-position-x': x,
89
- 'background-position-y': y
90
- });
91
- } :
92
- function($elem, x, y) {
93
- $elem.css('background-position', x + ' ' + y);
94
- }
95
- ),
96
-
97
- getBackgroundPosition = (supportsBackgroundPositionXY ?
98
- function($elem) {
99
- return [
100
- $elem.css('background-position-x'),
101
- $elem.css('background-position-y')
102
- ];
103
- } :
104
- function($elem) {
105
- return $elem.css('background-position').split(' ');
106
- }
107
- ),
108
-
109
- requestAnimFrame = (
110
- window.requestAnimationFrame ||
111
- window.webkitRequestAnimationFrame ||
112
- window.mozRequestAnimationFrame ||
113
- window.oRequestAnimationFrame ||
114
- window.msRequestAnimationFrame ||
115
- function(callback) {
116
- setTimeout(callback, 1000 / 60);
117
- }
118
- );
119
-
120
- function Plugin(element, options) {
121
- this.element = element;
122
- this.options = $.extend({}, defaults, options);
123
-
124
- this._defaults = defaults;
125
- this._name = pluginName;
126
-
127
- this.init();
128
- }
129
-
130
- Plugin.prototype = {
131
- init: function() {
132
- this.options.name = pluginName + '_' + Math.floor(Math.random() * 1e9);
133
-
134
- this._defineElements();
135
- this._defineGetters();
136
- this._defineSetters();
137
- this._handleWindowLoadAndResize();
138
- this._detectViewport();
139
-
140
- this.refresh({ firstLoad: true });
141
-
142
- if (this.options.scrollProperty === 'scroll') {
143
- this._handleScrollEvent();
144
- } else {
145
- this._startAnimationLoop();
146
- }
147
- },
148
- _defineElements: function() {
149
- if (this.element === document.body) this.element = window;
150
- this.$scrollElement = $(this.element);
151
- this.$element = (this.element === window ? $('body') : this.$scrollElement);
152
- this.$viewportElement = (this.options.viewportElement !== undefined ? $(this.options.viewportElement) : (this.$scrollElement[0] === window || this.options.scrollProperty === 'scroll' ? this.$scrollElement : this.$scrollElement.parent()) );
153
- },
154
- _defineGetters: function() {
155
- var self = this,
156
- scrollPropertyAdapter = scrollProperty[self.options.scrollProperty];
157
-
158
- this._getScrollLeft = function() {
159
- return scrollPropertyAdapter.getLeft(self.$scrollElement);
160
- };
161
-
162
- this._getScrollTop = function() {
163
- return scrollPropertyAdapter.getTop(self.$scrollElement);
164
- };
165
- },
166
- _defineSetters: function() {
167
- var self = this,
168
- scrollPropertyAdapter = scrollProperty[self.options.scrollProperty],
169
- positionPropertyAdapter = positionProperty[self.options.positionProperty],
170
- setScrollLeft = scrollPropertyAdapter.setLeft,
171
- setScrollTop = scrollPropertyAdapter.setTop;
172
-
173
- this._setScrollLeft = (typeof setScrollLeft === 'function' ? function(val) {
174
- setScrollLeft(self.$scrollElement, val);
175
- } : $.noop);
176
-
177
- this._setScrollTop = (typeof setScrollTop === 'function' ? function(val) {
178
- setScrollTop(self.$scrollElement, val);
179
- } : $.noop);
180
-
181
- this._setPosition = positionPropertyAdapter.setPosition ||
182
- function($elem, left, startingLeft, top, startingTop) {
183
- if (self.options.horizontalScrolling) {
184
- positionPropertyAdapter.setLeft($elem, left, startingLeft);
185
- }
186
-
187
- if (self.options.verticalScrolling) {
188
- positionPropertyAdapter.setTop($elem, top, startingTop);
189
- }
190
- };
191
- },
192
- _handleWindowLoadAndResize: function() {
193
- var self = this,
194
- $window = $(window);
195
-
196
- if (self.options.responsive) {
197
- $window.bind('load.' + this.name, function() {
198
- self.refresh();
199
- });
200
- }
201
-
202
- $window.bind('resize.' + this.name, function() {
203
- self._detectViewport();
204
-
205
- if (self.options.responsive) {
206
- self.refresh();
207
- }
208
- });
209
- },
210
- refresh: function(options) {
211
- var self = this,
212
- oldLeft = self._getScrollLeft(),
213
- oldTop = self._getScrollTop();
214
-
215
- if (!options || !options.firstLoad) {
216
- this._reset();
217
- }
218
-
219
- this._setScrollLeft(0);
220
- this._setScrollTop(0);
221
-
222
- this._setOffsets();
223
- this._findParticles();
224
- this._findBackgrounds();
225
-
226
- // Fix for WebKit background rendering bug
227
- if (options && options.firstLoad && /WebKit/.test(navigator.userAgent)) {
228
- $(window).load(function() {
229
- var oldLeft = self._getScrollLeft(),
230
- oldTop = self._getScrollTop();
231
-
232
- self._setScrollLeft(oldLeft + 1);
233
- self._setScrollTop(oldTop + 1);
234
-
235
- self._setScrollLeft(oldLeft);
236
- self._setScrollTop(oldTop);
237
- });
238
- }
239
-
240
- this._setScrollLeft(oldLeft);
241
- this._setScrollTop(oldTop);
242
- },
243
- _detectViewport: function() {
244
- var viewportOffsets = this.$viewportElement.offset(),
245
- hasOffsets = viewportOffsets !== null && viewportOffsets !== undefined;
246
-
247
- this.viewportWidth = this.$viewportElement.width();
248
- this.viewportHeight = this.$viewportElement.height();
249
-
250
- this.viewportOffsetTop = (hasOffsets ? viewportOffsets.top : 0);
251
- this.viewportOffsetLeft = (hasOffsets ? viewportOffsets.left : 0);
252
- },
253
- _findParticles: function() {
254
- var self = this,
255
- scrollLeft = this._getScrollLeft(),
256
- scrollTop = this._getScrollTop();
257
-
258
- if (this.particles !== undefined) {
259
- for (var i = this.particles.length - 1; i >= 0; i--) {
260
- this.particles[i].$element.data('stellar-elementIsActive', undefined);
261
- }
262
- }
263
-
264
- this.particles = [];
265
-
266
- if (!this.options.parallaxElements) return;
267
-
268
- this.$element.find('[data-stellar-ratio]').each(function(i) {
269
- var $this = $(this),
270
- horizontalOffset,
271
- verticalOffset,
272
- positionLeft,
273
- positionTop,
274
- marginLeft,
275
- marginTop,
276
- $offsetParent,
277
- offsetLeft,
278
- offsetTop,
279
- parentOffsetLeft = 0,
280
- parentOffsetTop = 0,
281
- tempParentOffsetLeft = 0,
282
- tempParentOffsetTop = 0;
283
-
284
- // Ensure this element isn't already part of another scrolling element
285
- if (!$this.data('stellar-elementIsActive')) {
286
- $this.data('stellar-elementIsActive', this);
287
- } else if ($this.data('stellar-elementIsActive') !== this) {
288
- return;
289
- }
290
-
291
- self.options.showElement($this);
292
-
293
- // Save/restore the original top and left CSS values in case we refresh the particles or destroy the instance
294
- if (!$this.data('stellar-startingLeft')) {
295
- $this.data('stellar-startingLeft', $this.css('left'));
296
- $this.data('stellar-startingTop', $this.css('top'));
297
- } else {
298
- $this.css('left', $this.data('stellar-startingLeft'));
299
- $this.css('top', $this.data('stellar-startingTop'));
300
- }
301
-
302
- positionLeft = $this.position().left;
303
- positionTop = $this.position().top;
304
-
305
- // Catch-all for margin top/left properties (these evaluate to 'auto' in IE7 and IE8)
306
- marginLeft = ($this.css('margin-left') === 'auto') ? 0 : parseInt($this.css('margin-left'), 10);
307
- marginTop = ($this.css('margin-top') === 'auto') ? 0 : parseInt($this.css('margin-top'), 10);
308
-
309
- offsetLeft = $this.offset().left - marginLeft;
310
- offsetTop = $this.offset().top - marginTop;
311
-
312
- // Calculate the offset parent
313
- $this.parents().each(function() {
314
- var $this = $(this);
315
-
316
- if ($this.data('stellar-offset-parent') === true) {
317
- parentOffsetLeft = tempParentOffsetLeft;
318
- parentOffsetTop = tempParentOffsetTop;
319
- $offsetParent = $this;
320
-
321
- return false;
322
- } else {
323
- tempParentOffsetLeft += $this.position().left;
324
- tempParentOffsetTop += $this.position().top;
325
- }
326
- });
327
-
328
- // Detect the offsets
329
- horizontalOffset = ($this.data('stellar-horizontal-offset') !== undefined ? $this.data('stellar-horizontal-offset') : ($offsetParent !== undefined && $offsetParent.data('stellar-horizontal-offset') !== undefined ? $offsetParent.data('stellar-horizontal-offset') : self.horizontalOffset));
330
- verticalOffset = ($this.data('stellar-vertical-offset') !== undefined ? $this.data('stellar-vertical-offset') : ($offsetParent !== undefined && $offsetParent.data('stellar-vertical-offset') !== undefined ? $offsetParent.data('stellar-vertical-offset') : self.verticalOffset));
331
-
332
- // Add our object to the particles collection
333
- self.particles.push({
334
- $element: $this,
335
- $offsetParent: $offsetParent,
336
- isFixed: $this.css('position') === 'fixed',
337
- horizontalOffset: horizontalOffset,
338
- verticalOffset: verticalOffset,
339
- startingPositionLeft: positionLeft,
340
- startingPositionTop: positionTop,
341
- startingOffsetLeft: offsetLeft,
342
- startingOffsetTop: offsetTop,
343
- parentOffsetLeft: parentOffsetLeft,
344
- parentOffsetTop: parentOffsetTop,
345
- stellarRatio: ($this.data('stellar-ratio') !== undefined ? $this.data('stellar-ratio') : 1),
346
- width: $this.outerWidth(true),
347
- height: $this.outerHeight(true),
348
- isHidden: false
349
- });
350
- });
351
- },
352
- _findBackgrounds: function() {
353
- var self = this,
354
- scrollLeft = this._getScrollLeft(),
355
- scrollTop = this._getScrollTop(),
356
- $backgroundElements;
357
-
358
- this.backgrounds = [];
359
-
360
- if (!this.options.parallaxBackgrounds) return;
361
-
362
- $backgroundElements = this.$element.find('[data-stellar-background-ratio]');
363
-
364
- if (this.$element.data('stellar-background-ratio')) {
365
- $backgroundElements = $backgroundElements.add(this.$element);
366
- }
367
-
368
- $backgroundElements.each(function() {
369
- var $this = $(this),
370
- backgroundPosition = getBackgroundPosition($this),
371
- horizontalOffset,
372
- verticalOffset,
373
- positionLeft,
374
- positionTop,
375
- marginLeft,
376
- marginTop,
377
- offsetLeft,
378
- offsetTop,
379
- $offsetParent,
380
- parentOffsetLeft = 0,
381
- parentOffsetTop = 0,
382
- tempParentOffsetLeft = 0,
383
- tempParentOffsetTop = 0;
384
-
385
- // Ensure this element isn't already part of another scrolling element
386
- if (!$this.data('stellar-backgroundIsActive')) {
387
- $this.data('stellar-backgroundIsActive', this);
388
- } else if ($this.data('stellar-backgroundIsActive') !== this) {
389
- return;
390
- }
391
-
392
- // Save/restore the original top and left CSS values in case we destroy the instance
393
- if (!$this.data('stellar-backgroundStartingLeft')) {
394
- $this.data('stellar-backgroundStartingLeft', backgroundPosition[0]);
395
- $this.data('stellar-backgroundStartingTop', backgroundPosition[1]);
396
- } else {
397
- setBackgroundPosition($this, $this.data('stellar-backgroundStartingLeft'), $this.data('stellar-backgroundStartingTop'));
398
- }
399
-
400
- // Catch-all for margin top/left properties (these evaluate to 'auto' in IE7 and IE8)
401
- marginLeft = ($this.css('margin-left') === 'auto') ? 0 : parseInt($this.css('margin-left'), 10);
402
- marginTop = ($this.css('margin-top') === 'auto') ? 0 : parseInt($this.css('margin-top'), 10);
403
-
404
- offsetLeft = $this.offset().left - marginLeft - scrollLeft;
405
- offsetTop = $this.offset().top - marginTop - scrollTop;
406
-
407
- // Calculate the offset parent
408
- $this.parents().each(function() {
409
- var $this = $(this);
410
-
411
- if ($this.data('stellar-offset-parent') === true) {
412
- parentOffsetLeft = tempParentOffsetLeft;
413
- parentOffsetTop = tempParentOffsetTop;
414
- $offsetParent = $this;
415
-
416
- return false;
417
- } else {
418
- tempParentOffsetLeft += $this.position().left;
419
- tempParentOffsetTop += $this.position().top;
420
- }
421
- });
422
-
423
- // Detect the offsets
424
- horizontalOffset = ($this.data('stellar-horizontal-offset') !== undefined ? $this.data('stellar-horizontal-offset') : ($offsetParent !== undefined && $offsetParent.data('stellar-horizontal-offset') !== undefined ? $offsetParent.data('stellar-horizontal-offset') : self.horizontalOffset));
425
- verticalOffset = ($this.data('stellar-vertical-offset') !== undefined ? $this.data('stellar-vertical-offset') : ($offsetParent !== undefined && $offsetParent.data('stellar-vertical-offset') !== undefined ? $offsetParent.data('stellar-vertical-offset') : self.verticalOffset));
426
-
427
- self.backgrounds.push({
428
- $element: $this,
429
- $offsetParent: $offsetParent,
430
- isFixed: $this.css('background-attachment') === 'fixed',
431
- horizontalOffset: horizontalOffset,
432
- verticalOffset: verticalOffset,
433
- startingValueLeft: backgroundPosition[0],
434
- startingValueTop: backgroundPosition[1],
435
- startingBackgroundPositionLeft: (isNaN(parseInt(backgroundPosition[0], 10)) ? 0 : parseInt(backgroundPosition[0], 10)),
436
- startingBackgroundPositionTop: (isNaN(parseInt(backgroundPosition[1], 10)) ? 0 : parseInt(backgroundPosition[1], 10)),
437
- startingPositionLeft: $this.position().left,
438
- startingPositionTop: $this.position().top,
439
- startingOffsetLeft: offsetLeft,
440
- startingOffsetTop: offsetTop,
441
- parentOffsetLeft: parentOffsetLeft,
442
- parentOffsetTop: parentOffsetTop,
443
- stellarRatio: ($this.data('stellar-background-ratio') === undefined ? 1 : $this.data('stellar-background-ratio'))
444
- });
445
- });
446
- },
447
- _reset: function() {
448
- var particle,
449
- startingPositionLeft,
450
- startingPositionTop,
451
- background,
452
- i;
453
-
454
- for (i = this.particles.length - 1; i >= 0; i--) {
455
- particle = this.particles[i];
456
- startingPositionLeft = particle.$element.data('stellar-startingLeft');
457
- startingPositionTop = particle.$element.data('stellar-startingTop');
458
-
459
- this._setPosition(particle.$element, startingPositionLeft, startingPositionLeft, startingPositionTop, startingPositionTop);
460
-
461
- this.options.showElement(particle.$element);
462
-
463
- particle.$element.data('stellar-startingLeft', null).data('stellar-elementIsActive', null).data('stellar-backgroundIsActive', null);
464
- }
465
-
466
- for (i = this.backgrounds.length - 1; i >= 0; i--) {
467
- background = this.backgrounds[i];
468
-
469
- background.$element.data('stellar-backgroundStartingLeft', null).data('stellar-backgroundStartingTop', null);
470
-
471
- setBackgroundPosition(background.$element, background.startingValueLeft, background.startingValueTop);
472
- }
473
- },
474
- destroy: function() {
475
- this._reset();
476
-
477
- this.$scrollElement.unbind('resize.' + this.name).unbind('scroll.' + this.name);
478
- this._animationLoop = $.noop;
479
-
480
- $(window).unbind('load.' + this.name).unbind('resize.' + this.name);
481
- },
482
- _setOffsets: function() {
483
- var self = this,
484
- $window = $(window);
485
-
486
- $window.unbind('resize.horizontal-' + this.name).unbind('resize.vertical-' + this.name);
487
-
488
- if (typeof this.options.horizontalOffset === 'function') {
489
- this.horizontalOffset = this.options.horizontalOffset();
490
- $window.bind('resize.horizontal-' + this.name, function() {
491
- self.horizontalOffset = self.options.horizontalOffset();
492
- });
493
- } else {
494
- this.horizontalOffset = this.options.horizontalOffset;
495
- }
496
-
497
- if (typeof this.options.verticalOffset === 'function') {
498
- this.verticalOffset = this.options.verticalOffset();
499
- $window.bind('resize.vertical-' + this.name, function() {
500
- self.verticalOffset = self.options.verticalOffset();
501
- });
502
- } else {
503
- this.verticalOffset = this.options.verticalOffset;
504
- }
505
- },
506
- _repositionElements: function() {
507
- var scrollLeft = this._getScrollLeft(),
508
- scrollTop = this._getScrollTop(),
509
- horizontalOffset,
510
- verticalOffset,
511
- particle,
512
- fixedRatioOffset,
513
- background,
514
- bgLeft,
515
- bgTop,
516
- isVisibleVertical = true,
517
- isVisibleHorizontal = true,
518
- newPositionLeft,
519
- newPositionTop,
520
- newOffsetLeft,
521
- newOffsetTop,
522
- i;
523
-
524
- // First check that the scroll position or container size has changed
525
- if (this.currentScrollLeft === scrollLeft && this.currentScrollTop === scrollTop && this.currentWidth === this.viewportWidth && this.currentHeight === this.viewportHeight) {
526
- return;
527
- } else {
528
- this.currentScrollLeft = scrollLeft;
529
- this.currentScrollTop = scrollTop;
530
- this.currentWidth = this.viewportWidth;
531
- this.currentHeight = this.viewportHeight;
532
- }
533
-
534
- // Reposition elements
535
- for (i = this.particles.length - 1; i >= 0; i--) {
536
- particle = this.particles[i];
537
-
538
- fixedRatioOffset = (particle.isFixed ? 1 : 0);
539
-
540
- // Calculate position, then calculate what the particle's new offset will be (for visibility check)
541
- if (this.options.horizontalScrolling) {
542
- newPositionLeft = (scrollLeft + particle.horizontalOffset + this.viewportOffsetLeft + particle.startingPositionLeft - particle.startingOffsetLeft + particle.parentOffsetLeft) * -(particle.stellarRatio + fixedRatioOffset - 1) + particle.startingPositionLeft;
543
- newOffsetLeft = newPositionLeft - particle.startingPositionLeft + particle.startingOffsetLeft;
544
- } else {
545
- newPositionLeft = particle.startingPositionLeft;
546
- newOffsetLeft = particle.startingOffsetLeft;
547
- }
548
-
549
- if (this.options.verticalScrolling) {
550
- newPositionTop = (scrollTop + particle.verticalOffset + this.viewportOffsetTop + particle.startingPositionTop - particle.startingOffsetTop + particle.parentOffsetTop) * -(particle.stellarRatio + fixedRatioOffset - 1) + particle.startingPositionTop;
551
- newOffsetTop = newPositionTop - particle.startingPositionTop + particle.startingOffsetTop;
552
- } else {
553
- newPositionTop = particle.startingPositionTop;
554
- newOffsetTop = particle.startingOffsetTop;
555
- }
556
-
557
- // Check visibility
558
- if (this.options.hideDistantElements) {
559
- isVisibleHorizontal = !this.options.horizontalScrolling || newOffsetLeft + particle.width > (particle.isFixed ? 0 : scrollLeft) && newOffsetLeft < (particle.isFixed ? 0 : scrollLeft) + this.viewportWidth + this.viewportOffsetLeft;
560
- isVisibleVertical = !this.options.verticalScrolling || newOffsetTop + particle.height > (particle.isFixed ? 0 : scrollTop) && newOffsetTop < (particle.isFixed ? 0 : scrollTop) + this.viewportHeight + this.viewportOffsetTop;
561
- }
562
-
563
- if (isVisibleHorizontal && isVisibleVertical) {
564
- if (particle.isHidden) {
565
- this.options.showElement(particle.$element);
566
- particle.isHidden = false;
567
- }
568
-
569
- this._setPosition(particle.$element, newPositionLeft, particle.startingPositionLeft, newPositionTop, particle.startingPositionTop);
570
- } else {
571
- if (!particle.isHidden) {
572
- this.options.hideElement(particle.$element);
573
- particle.isHidden = true;
574
- }
575
- }
576
- }
577
-
578
- // Reposition backgrounds
579
- for (i = this.backgrounds.length - 1; i >= 0; i--) {
580
- background = this.backgrounds[i];
581
-
582
- fixedRatioOffset = (background.isFixed ? 0 : 1);
583
- bgLeft = (this.options.horizontalScrolling ? (scrollLeft + background.horizontalOffset - this.viewportOffsetLeft - background.startingOffsetLeft + background.parentOffsetLeft - background.startingBackgroundPositionLeft) * (fixedRatioOffset - background.stellarRatio) + 'px' : background.startingValueLeft);
584
- bgTop = (this.options.verticalScrolling ? (scrollTop + background.verticalOffset - this.viewportOffsetTop - background.startingOffsetTop + background.parentOffsetTop - background.startingBackgroundPositionTop) * (fixedRatioOffset - background.stellarRatio) + 'px' : background.startingValueTop);
585
-
586
- setBackgroundPosition(background.$element, bgLeft, bgTop);
587
- }
588
- },
589
- _handleScrollEvent: function() {
590
- var self = this,
591
- ticking = false;
592
-
593
- var update = function() {
594
- self._repositionElements();
595
- ticking = false;
596
- };
597
-
598
- var requestTick = function() {
599
- if (!ticking) {
600
- requestAnimFrame(update);
601
- ticking = true;
602
- }
603
- };
604
-
605
- this.$scrollElement.bind('scroll.' + this.name, requestTick);
606
- requestTick();
607
- },
608
- _startAnimationLoop: function() {
609
- var self = this;
610
-
611
- this._animationLoop = function() {
612
- requestAnimFrame(self._animationLoop);
613
- self._repositionElements();
614
- };
615
- this._animationLoop();
616
- }
617
- };
618
-
619
- $.fn[pluginName] = function (options) {
620
- var args = arguments;
621
- if (options === undefined || typeof options === 'object') {
622
- return this.each(function () {
623
- if (!$.data(this, 'plugin_' + pluginName)) {
624
- $.data(this, 'plugin_' + pluginName, new Plugin(this, options));
625
- }
626
- });
627
- } else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') {
628
- return this.each(function () {
629
- var instance = $.data(this, 'plugin_' + pluginName);
630
- if (instance instanceof Plugin && typeof instance[options] === 'function') {
631
- instance[options].apply(instance, Array.prototype.slice.call(args, 1));
632
- }
633
- if (options === 'destroy') {
634
- $.data(this, 'plugin_' + pluginName, null);
635
- }
636
- });
637
- }
638
- };
639
-
640
- $[pluginName] = function(options) {
641
- var $window = $(window);
642
- return $window.stellar.apply($window, Array.prototype.slice.call(arguments, 0));
643
- };
644
-
645
- // Expose the scroll and position property function hashes so they can be extended
646
- $[pluginName].scrollProperty = scrollProperty;
647
- $[pluginName].positionProperty = positionProperty;
648
-
649
- // Expose the plugin class so it can be modified
650
- window.Stellar = Plugin;
651
- }(jQuery, this, document));