1/*! Stellar.js v0.6.2 | Copyright 2013, Mark Dalgleish | http://markdalgleish.com/projects/stellar.js | http://markdalgleish.mit-license.org */ 2(function (e, t, n, r) { 3 function d(t, n) { 4 this.element = t, this.options = e.extend({}, s, n), this._defaults = s, this._name = i, this.init() 5 } 6 7 var i = "stellar", s = {scrollProperty: "scroll", positionProperty: "position", horizontalScrolling: !0, verticalScrolling: !0, horizontalOffset: 0, verticalOffset: 0, responsive: !1, parallaxBackgrounds: !0, parallaxElements: !0, hideDistantElements: !0, hideElement: function (e) { 8 e.hide() 9 }, showElement: function (e) { 10 e.show() 11 }}, o = {scroll: {getLeft: function (e) { 12 return e.scrollLeft() 13 }, setLeft: function (e, t) { 14 e.scrollLeft(t) 15 }, getTop: function (e) { 16 return e.scrollTop() 17 }, setTop: function (e, t) { 18 e.scrollTop(t) 19 }}, position: {getLeft: function (e) { 20 return parseInt(e.css("left"), 10) * -1 21 }, getTop: function (e) { 22 return parseInt(e.css("top"), 10) * -1 23 }}, margin: {getLeft: function (e) { 24 return parseInt(e.css("margin-left"), 10) * -1 25 }, getTop: function (e) { 26 return parseInt(e.css("margin-top"), 10) * -1 27 }}, transform: {getLeft: function (e) { 28 var t = getComputedStyle(e[0])[f]; 29 return t !== "none" ? parseInt(t.match(/(-?[0-9]+)/g)[4], 10) * -1 : 0 30 }, getTop: function (e) { 31 var t = getComputedStyle(e[0])[f]; 32 return t !== "none" ? parseInt(t.match(/(-?[0-9]+)/g)[5], 10) * -1 : 0 33 }}}, u = {position: {setLeft: function (e, t) { 34 e.css("left", t) 35 }, setTop: function (e, t) { 36 e.css("top", t) 37 }}, transform: {setPosition: function (e, t, n, r, i) { 38 e[0].style[f] = "translate3d(" + (t - n) + "px, " + (r - i) + "px, 0)" 39 }}}, a = function () { 40 var t = /^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/, n = e("script")[0].style, r = "", i; 41 for (i in n)if (t.test(i)) { 42 r = i.match(t)[0]; 43 break 44 } 45 return"WebkitOpacity"in n && (r = "Webkit"), "KhtmlOpacity"in n && (r = "Khtml"), function (e) { 46 return r + (r.length > 0 ? e.charAt(0).toUpperCase() + e.slice(1) : e) 47 } 48 }(), f = a("transform"), l = e("<div />", {style: "background:#fff"}).css("background-position-x") !== r, c = l ? function (e, t, n) { 49 e.css({"background-position-x": t, "background-position-y": n}) 50 } : function (e, t, n) { 51 e.css("background-position", t + " " + n) 52 }, h = l ? function (e) { 53 return[e.css("background-position-x"), e.css("background-position-y")] 54 } : function (e) { 55 return e.css("background-position").split(" ") 56 }, p = t.requestAnimationFrame || t.webkitRequestAnimationFrame || t.mozRequestAnimationFrame || t.oRequestAnimationFrame || t.msRequestAnimationFrame || function (e) { 57 setTimeout(e, 1e3 / 60) 58 }; 59 d.prototype = {init: function () { 60 this.options.name = i + "_" + Math.floor(Math.random() * 1e9), this._defineElements(), this._defineGetters(), this._defineSetters(), this._handleWindowLoadAndResize(), this._detectViewport(), this.refresh({firstLoad: !0}), this.options.scrollProperty === "scroll" ? this._handleScrollEvent() : this._startAnimationLoop() 61 }, _defineElements: function () { 62 this.element === n.body && (this.element = t), this.$scrollElement = e(this.element), this.$element = this.element === t ? e("body") : this.$scrollElement, this.$viewportElement = this.options.viewportElement !== r ? e(this.options.viewportElement) : this.$scrollElement[0] === t || this.options.scrollProperty === "scroll" ? this.$scrollElement : this.$scrollElement.parent() 63 }, _defineGetters: function () { 64 var e = this, t = o[e.options.scrollProperty]; 65 this._getScrollLeft = function () { 66 return t.getLeft(e.$scrollElement) 67 }, this._getScrollTop = function () { 68 return t.getTop(e.$scrollElement) 69 } 70 }, _defineSetters: function () { 71 var t = this, n = o[t.options.scrollProperty], r = u[t.options.positionProperty], i = n.setLeft, s = n.setTop; 72 this._setScrollLeft = typeof i == "function" ? function (e) { 73 i(t.$scrollElement, e) 74 } : e.noop, this._setScrollTop = typeof s == "function" ? function (e) { 75 s(t.$scrollElement, e) 76 } : e.noop, this._setPosition = r.setPosition || function (e, n, i, s, o) { 77 t.options.horizontalScrolling && r.setLeft(e, n, i), t.options.verticalScrolling && r.setTop(e, s, o) 78 } 79 }
79, _handleWindowLoadAndResize: function () { 80 var n = this, r = e(t); 81 n.options.responsive && r.bind("load." + this.name, function () { 82 n.refresh() 83 }), r.bind("resize." + this.name, function () { 84 n._detectViewport(), n.options.responsive && n.refresh() 85 }) 86 }, refresh: function (n) { 87 var r = this, i = r._getScrollLeft(), s = r._getScrollTop(); 88 (!n || !n.firstLoad) && this._reset(), this._setScrollLeft(0), this._setScrollTop(0), this._setOffsets(), this._findParticles(), this._findBackgrounds(), n && n.firstLoad && /WebKit/.test(navigator.userAgent) && e(t).load(function () { 89 var e = r._getScrollLeft(), t = r._getScrollTop(); 90 r._setScrollLeft(e + 1), r._setScrollTop(t + 1), r._setScrollLeft(e), r._setScrollTop(t) 91 }), this._setScrollLeft(i), this._setScrollTop(s) 92 }, _detectViewport: function () { 93 var e = this.$viewportElement.offset(), t = e !== null && e !== r; 94 this.viewportWidth = this.$viewportElement.width(), this.viewportHeight = this.$viewportElement.height(), this.viewportOffsetTop = t ? e.top : 0, this.viewportOffsetLeft = t ? e.left : 0 95 }, _findParticles: function () { 96 var t = this, n = this._getScrollLeft(), i = this._getScrollTop(); 97 if (this.particles !== r)for (var s = this.particles.length - 1; s >= 0; s--)this.particles[s].$element.data("stellar-elementIsActive", r); 98 this.particles = []; 99 if (!this.options.parallaxElements)return; 100 this.$element.find("[data-stellar-ratio]").each(function (n) { 101 var i = e(this), s, o, u, a, f, l, c, h, p, d = 0, v = 0, m = 0, g = 0; 102 if (!i.data("stellar-elementIsActive"))i.data("stellar-elementIsActive", this); else if (i.data("stellar-elementIsActive") !== this)return; 103 t.options.showElement(i), i.data("stellar-startingLeft") ? (i.css("left", i.data("stellar-startingLeft")), i.css("top", i.data("stellar-startingTop"))) : (i.data("stellar-startingLeft", i.css("left")), i.data("stellar-startingTop", i.css("top"))), u = i.position().left, a = i.position().top, f = i.css("margin-left") === "auto" ? 0 : parseInt(i.css("margin-left"), 10), l = i.css("margin-top") === "auto" ? 0 : parseInt(i.css("margin-top"), 10), h = i.offset().left - f, p = i.offset().top - l, i.parents().each(function () { 104 var t = e(this); 105 if (t.data("stellar-offset-parent") === !0)return d = m, v = g, c = t, !1; 106 m += t.position().left, g += t.position().top 107 }), s = i.data("stellar-horizontal-offset") !== r ? i.data("stellar-horizontal-offset") : c !== r && c.data("stellar-horizontal-offset") !== r ? c.data("stellar-horizontal-offset") : t.horizontalOffset, o = i.data("stellar-vertical-offset") !== r ? i.data("stellar-vertical-offset") : c !== r && c.data("stellar-vertical-offset") !== r ? c.data("stellar-vertical-offset") : t.verticalOffset, t.particles.push({$element: i, $offsetParent: c, isFixed: i.css("position") === "fixed", horizontalOffset: s, verticalOffset: o, startingPositionLeft: u, startingPositionTop: a, startingOffsetLeft: h, startingOffsetTop: p, parentOffsetLeft: d, parentOffsetTop: v, stellarRatio: i.data("stellar-ratio") !== r ? i.data("stellar-ratio") : 1, width: i.outerWidth(!0), height: i.outerHeight(!0), isHidden: !1}) 108 }) 109 }, _findBackgrounds: function () { 110 var t = this, n = this._getScrollLeft(), i = this._getScrollTop(), s; 111 this.backgrounds = []; 112 if (!this.options.parallaxBackgrounds)return; 113 s = this.$element.find("[data-stellar-background-ratio]"), this.$element.data("stellar-background-ratio") && (s = s.add(this.$element)), s.each(function () { 114 var s = e(this), o = h(s), u, a, f, l, p, d, v, m, g, y = 0, b = 0, w = 0, E = 0; 115 if (!s.data("stellar-backgroundIsActive"))s.data("stellar-backgroundIsActive", this); else if (s.data("stellar-backgroundIsActive") !== this)return; 116 s.data("stellar-backgroundStartingLeft") ? c(s, s.data("stellar-backgroundStartingLeft"), s.data("stellar-backgroundStartingTop")) : (s.data("stellar-backgroundStartingLeft", o[0]), s.data("stellar-backgroundStartingTop", o[1])), p = s.css("margin-left") === "auto" ? 0 : parseInt(s.css("margin-left"), 10), d = s.css("margin-top") === "auto" ? 0 : parseInt(s.css("margin-top"), 10), v = s.offset().left - p - n, m = s.offset().top - d - i, s.parents().each(function () { 117 var t = e(this); 118 if (t.data("stellar-offset-parent") === !0)return y = w, b = E, g = t, !1; 119 w += t.position().left, E += t.position().top 120 }), u = s.data("stellar-horizontal-offset") !== r ? s.data("stellar-horizontal-offset") : g !== r && g.data("stellar-horizontal-offset") !== r ? g.data("stellar-horizontal-offset") : t.horizontalOffset, a = s.data("stellar-vertical-offset") !== r ? s.data("stellar-vertical-offset") : g !== r && g.data("stellar-vertical-offset") !== r ? g.data("stellar-vertical-offset") : t.verticalOffset, t.backgrounds.push({$element: s, $offsetParent: g, isFixed:
120s.css("background-attachment") === "fixed", horizontalOffset: u, verticalOffset: a, startingValueLeft: o[0], startingValueTop: o[1], startingBackgroundPositionLeft: isNaN(parseInt(o[0], 10)) ? 0 : parseInt(o[0], 10), startingBackgroundPositionTop: isNaN(parseInt(o[1], 10)) ? 0 : parseInt(o[1], 10), startingPositionLeft: s.position().left, startingPositionTop: s.position().top, startingOffsetLeft: v, startingOffsetTop: m, parentOffsetLeft: y, parentOffsetTop: b, stellarRatio: s.data("stellar-background-ratio") === r ? 1 : s.data("stellar-background-ratio")}) 121 }) 122 }, _reset: function () { 123 var e, t, n, r, i; 124 for (i = this.particles.length - 1; i >= 0; i--)e = this.particles[i], t = e.$element.data("stellar-startingLeft"), n = e.$element.data("stellar-startingTop"), this._setPosition(e.$element, t, t, n, n), this.options.showElement(e.$element), e.$element.data("stellar-startingLeft", null).data("stellar-elementIsActive", null).data("stellar-backgroundIsActive", null); 125 for (i = this.backgrounds.length - 1; i >= 0; i--)r = this.backgrounds[i], r.$element.data("stellar-backgroundStartingLeft", null).data("stellar-backgroundStartingTop", null), c(r.$element, r.startingValueLeft, r.startingValueTop) 126 }, destroy: function () { 127 this._reset(), this.$scrollElement.unbind("resize." + this.name).unbind("scroll." + this.name), this._animationLoop = e.noop, e(t).unbind("load." + this.name).unbind("resize." + this.name) 128 }, _setOffsets: function () { 129 var n = this, r = e(t); 130 r.unbind("resize.horizontal-" + this.name).unbind("resize.vertical-" + this.name), typeof this.options.horizontalOffset == "function" ? (this.horizontalOffset = this.options.horizontalOffset(), r.bind("resize.horizontal-" + this.name, function () { 131 n.horizontalOffset = n.options.horizontalOffset() 132 })) : this.horizontalOffset = this.options.horizontalOffset, typeof this.options.verticalOffset == "function" ? (this.verticalOffset = this.options.verticalOffset(), r.bind("resize.vertical-" + this.name, function () { 133 n.verticalOffset = n.options.verticalOffset() 134 })) : this.verticalOffset = this.options.verticalOffset 135 }, _repositionElements: function () { 136 var e = this._getScrollLeft(), t = this._getScrollTop(), n, r, i, s, o, u, a, f = !0, l = !0, h, p, d, v, m; 137 if (this.currentScrollLeft === e && this.currentScrollTop === t && this.currentWidth === this.viewportWidth && this.currentHeight === this.viewportHeight)return; 138 this.currentScrollLeft = e, this.currentScrollTop = t, this.currentWidth = this.viewportWidth, this.currentHeight = this.viewportHeight; 139 for (m = this.particles.length - 1; m >= 0; m--)i = this.particles[m], s = i.isFixed ? 1 : 0, this.options.horizontalScrolling ? (h = (e + i.horizontalOffset + this.viewportOffsetLeft + i.startingPositionLeft - i.startingOffsetLeft + i.parentOffsetLeft) * -(i.stellarRatio + s - 1) + i.startingPositionLeft, d = h - i.startingPositionLeft + i.startingOffsetLeft) : (h = i.startingPositionLeft, d = i.startingOffsetLeft), this.options.verticalScrolling ? (p = (t + i.verticalOffset + this.viewportOffsetTop + i.startingPositionTop - i.startingOffsetTop + i.parentOffsetTop) * -(i.stellarRatio + s - 1) + i.startingPositionTop, v = p - i.startingPositionTop + i.startingOffsetTop) : (p = i.startingPositionTop, v = i.startingOffsetTop), this.options.hideDistantElements && (l = !this.options.horizontalScrolling || d + i.width > (i.isFixed ? 0 : e) && d < (i.isFixed ? 0 : e) + this.viewportWidth + this.viewportOffsetLeft, f = !this.options.verticalScrolling || v + i.height > (i.isFixed ? 0 : t) && v < (i.isFixed ? 0 : t) + this.viewportHeight + this.viewportOffsetTop), l && f ? (i.isHidden && (this.options.showElement(i.$element), i.isHidden = !1), this._setPosition(i.$element, h, i.startingPositionLeft, p, i.startingPositionTop)) : i.isHidden || (this.options.hideElement(i.$element), i.isHidden = !0); 140 for (m = this.backgrounds.length - 1; m >= 0; m--)o = this.backgrounds[m], s = o.isFixed ? 0 : 1, u = this.options.horizontalScrolling ? (e + o.horizontalOffset - this.viewportOffsetLeft - o.startingOffsetLeft + o.parentOffsetLeft - o.startingBackgroun
140dPositionLeft) * (s - o.stellarRatio) + "px" : o.startingValueLeft, a = this.options.verticalScrolling ? (t + o.verticalOffset - this.viewportOffsetTop - o.startingOffsetTop + o.parentOffsetTop - o.startingBackgroundPositionTop) * (s - o.stellarRatio) + "px" : o.startingValueTop, c(o.$element, u, a) 141 }, _handleScrollEvent: function () { 142 var e = this, t = !1, n = function () { 143 e._repositionElements(), t = !1 144 }, r = function () { 145 t || (p(n), t = !0) 146 }; 147 this.$scrollElement.bind("scroll." + this.name, r), r() 148 }, _startAnimationLoop: function () { 149 var e = this; 150 this._animationLoop = function () { 151 p(e._animationLoop), e._repositionElements() 152 }, this._animationLoop() 153 }}, e.fn[i] = function (t) { 154 var n = arguments; 155 if (t === r || typeof t == "object")return this.each(function () { 156 e.data(this, "plugin_" + i) || e.data(this, "plugin_" + i, new d(this, t)) 157 }); 158 if (typeof t == "string" && t[0] !== "_" && t !== "init")return this.each(function () { 159 var r = e.data(this, "plugin_" + i); 160 r instanceof d && typeof r[t] == "function" && r[t].apply(r, Array.prototype.slice.call(n, 1)), t === "destroy" && e.data(this, "plugin_" + i, null) 161 }) 162 }, e[i] = function (n) { 163 var r = e(t); 164 return r.stellar.apply(r, Array.prototype.slice.call(arguments, 0)) 165 }, e[i].scrollProperty = o, e[i].positionProperty = u, t.Stellar = d 166})(jQuery, this, document);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.