! function(t, i, e, s) { "use strict"; function n(i, e) { this.element = i, this.$context = t(i).data("api", this), this.$layers = this.$context.find(".layer"); var s = { calibratex: this.$context.data("calibrate-x") || null, calibratey: this.$context.data("calibrate-y") || null, invertx: this.$context.data("invert-x") || null, inverty: this.$context.data("invert-y") || null, limitx: parsefloat(this.$context.data("limit-x")) || null, limity: parsefloat(this.$context.data("limit-y")) || null, scalarx: parsefloat(this.$context.data("scalar-x")) || null, scalary: parsefloat(this.$context.data("scalar-y")) || null, frictionx: parsefloat(this.$context.data("friction-x")) || null, frictiony: parsefloat(this.$context.data("friction-y")) || null, originx: parsefloat(this.$context.data("origin-x")) || null, originy: parsefloat(this.$context.data("origin-y")) || null, pointerevents: this.$context.data("pointer-events") || !0, precision: parsefloat(this.$context.data("precision")) || 1 }; for (var n in s) null === s[n] && delete s[n]; t.extend(this, a, e, s), this.calibrationtimer = null, this.calibrationflag = !0, this.enabled = !1, this.depthsx = [], this.depthsy = [], this.raf = null, this.bounds = null, this.ex = 0, this.ey = 0, this.ew = 0, this.eh = 0, this.ecx = 0, this.ecy = 0, this.erx = 0, this.ery = 0, this.cx = 0, this.cy = 0, this.ix = 0, this.iy = 0, this.mx = 0, this.my = 0, this.vx = 0, this.vy = 0, this.onmousemove = this.onmousemove.bind(this), this.ondeviceorientation = this.ondeviceorientation.bind(this), this.onorientationtimer = this.onorientationtimer.bind(this), this.oncalibrationtimer = this.oncalibrationtimer.bind(this), this.onanimationframe = this.onanimationframe.bind(this), this.onwindowresize = this.onwindowresize.bind(this), this.initialise() } var o = "parallax", r = 30, a = { relativeinput: !1, cliprelativeinput: !1, calibrationthreshold: 100, calibrationdelay: 500, supportdelay: 500, calibratex: !1, calibratey: !0, invertx: !0, inverty: !0, limitx: !1, limity: !1, scalarx: 10, scalary: 10, frictionx: .1, frictiony: .1, originx: .5, originy: .5, pointerevents: !0, precision: 1 }; n.prototype.transformsupport = function(t) { for (var n = e.createelement("div"), o = !1, r = null, a = !1, h = null, l = null, p = 0, c = this.vendors.length; c > p; p++) if (null !== this.vendors[p] ? (h = this.vendors[p][0] + "transform", l = this.vendors[p][1] + "transform") : (h = "transform", l = "transform"), n.style[l] !== s) { o = !0; break } switch (t) { case "2d": a = o; break; case "3d": if (o) { var m = e.body || e.createelement("body"), u = e.documentelement, y = u.style.overflow, d = !1; e.body || (d = !0, u.style.overflow = "hidden", u.appendchild(m), m.style.overflow = "hidden", m.style.background = ""), m.appendchild(n), n.style[l] = "translate3d(1px,1px,1px)", r = i.getcomputedstyle(n).getpropertyvalue(h), a = r !== s && r.length > 0 && "none" !== r, u.style.overflow = y, m.removechild(n), d && (m.removeattribute("style"), m.parentnode.removechild(m)) } } return a }, n.prototype.ww = null, n.prototype.wh = null, n.prototype.wcx = null, n.prototype.wcy = null, n.prototype.wrx = null, n.prototype.wry = null, n.prototype.portrait = null, n.prototype.desktop = !navigator.useragent.match(/(iphone|ipod|ipad|android|blackberry|bb10|mobi|tablet|opera mini|nexus 7)/i), n.prototype.vendors = [null, ["-webkit-", "webkit"], ["-moz-", "moz"], ["-o-", "o"], ["-ms-", "ms"]], n.prototype.motionsupport = !!i.devicemotionevent, n.prototype.orientationsupport = !!i.deviceorientationevent, n.prototype.orientationstatus = 0, n.prototype.transform2dsupport = n.prototype.transformsupport("2d"), n.prototype.transform3dsupport = n.prototype.transformsupport("3d"), n.prototype.propertycache = {}, n.prototype.initialise = function() { "static" === this.$context.css("position") && this.$context.css({ position: "relative" }), this.pointerevents || this.$context.css({ pointerevents: "none" }), this.accelerate(this.$context), this.updatelayers(), this.updatedimensions(), this.enable(), this.queuecalibration(this.calibrationdelay) }, n.prototype.updatelayers = function() { this.$layers = this.$context.find(".layer"), this.depthsx = [], this.depthsy = [], this.$layers.css({ position: "absolute", display: "block", left: 0, top: 0 }), this.$layers.first().css({ position: "relative" }), this.accelerate(this.$layers), this.$layers.each(t.proxy(function(i, e) { var s = t(e).data("depth") || 0; this.depthsx.push(t(e).data("depth-x") || s), this.depthsy.push(t(e).data("depth-y") || s) }, this)) }, n.prototype.updatedimensions = function() { this.ww = i.innerwidth, this.wh = i.innerheight, this.wcx = this.ww * this.originx, this.wcy = this.wh * this.originy, this.wrx = math.max(this.wcx, this.ww - this.wcx), this.wry = math.max(this.wcy, this.wh - this.wcy) }, n.prototype.updatebounds = function() { this.bounds = this.element.getboundingclientrect(), this.ex = this.bounds.left, this.ey = this.bounds.top, this.ew = this.bounds.width, this.eh = this.bounds.height, this.ecx = this.ew * this.originx, this.ecy = this.eh * this.originy, this.erx = math.max(this.ecx, this.ew - this.ecx), this.ery = math.max(this.ecy, this.eh - this.ecy) }, n.prototype.queuecalibration = function(t) { cleartimeout(this.calibrationtimer), this.calibrationtimer = settimeout(this.oncalibrationtimer, t) }, n.prototype.enable = function() { this.enabled || (this.enabled = !0, this.orientationsupport ? (this.portrait = null, i.addeventlistener("deviceorientation", this.ondeviceorientation), settimeout(this.onorientationtimer, this.supportdelay)) : (this.cx = 0, this.cy = 0, this.portrait = !1, i.addeventlistener("mousemove", this.onmousemove)), i.addeventlistener("resize", this.onwindowresize), this.raf = requestanimationframe(this.onanimationframe)) }, n.prototype.disable = function() { this.enabled && (this.enabled = !1, this.orientationsupport ? i.removeeventlistener("deviceorientation", this.ondeviceorientation) : i.removeeventlistener("mousemove", this.onmousemove), i.removeeventlistener("resize", this.onwindowresize), cancelanimationframe(this.raf)) }, n.prototype.calibrate = function(t, i) { this.calibratex = t === s ? this.calibratex: t, this.calibratey = i === s ? this.calibratey: i }, n.prototype.invert = function(t, i) { this.invertx = t === s ? this.invertx: t, this.inverty = i === s ? this.inverty: i }, n.prototype.friction = function(t, i) { this.frictionx = t === s ? this.frictionx: t, this.frictiony = i === s ? this.frictiony: i }, n.prototype.scalar = function(t, i) { this.scalarx = t === s ? this.scalarx: t, this.scalary = i === s ? this.scalary: i }, n.prototype.limit = function(t, i) { this.limitx = t === s ? this.limitx: t, this.limity = i === s ? this.limity: i }, n.prototype.origin = function(t, i) { this.originx = t === s ? this.originx: t, this.originy = i === s ? this.originy: i }, n.prototype.clamp = function(t, i, e) { return t = math.max(t, i), t = math.min(t, e) }, n.prototype.css = function(i, e, n) { var o = this.propertycache[e]; if (!o) for (var r = 0, a = this.vendors.length; a > r; r++) if (o = null !== this.vendors[r] ? t.camelcase(this.vendors[r][1] + "-" + e) : e, i.style[o] !== s) { this.propertycache[e] = o; break } i.style[o] = n }, n.prototype.accelerate = function(t) { for (var i = 0, e = t.length; e > i; i++) { var s = t[i]; this.css(s, "transform", "translate3d(0,0,0)"), this.css(s, "transform-style", "preserve-3d"), this.css(s, "backface-visibility", "hidden") } }, n.prototype.setposition = function(t, i, e) { i += "px", e += "px", this.transform3dsupport ? this.css(t, "transform", "translate3d(" + i + "," + e + ",0)") : this.transform2dsupport ? this.css(t, "transform", "translate(" + i + "," + e + ")") : (t.style.left = i, t.style.top = e) }, n.prototype.onorientationtimer = function(t) { this.orientationsupport && 0 === this.orientationstatus && (this.disable(), this.orientationsupport = !1, this.enable()) }, n.prototype.oncalibrationtimer = function(t) { this.calibrationflag = !0 }, n.prototype.onwindowresize = function(t) { this.updatedimensions() }, n.prototype.onanimationframe = function() { this.updatebounds(); var t = this.ix - this.cx, i = this.iy - this.cy; (math.abs(t) > this.calibrationthreshold || math.abs(i) > this.calibrationthreshold) && this.queuecalibration(0), this.portrait ? (this.mx = this.calibratex ? i: this.iy, this.my = this.calibratey ? t: this.ix) : (this.mx = this.calibratex ? t: this.ix, this.my = this.calibratey ? i: this.iy), this.mx *= this.ew * (this.scalarx / 100), this.my *= this.eh * (this.scalary / 100), isnan(parsefloat(this.limitx)) || (this.mx = this.clamp(this.mx, -this.limitx, this.limitx)), isnan(parsefloat(this.limity)) || (this.my = this.clamp(this.my, -this.limity, this.limity)), this.vx += (this.mx - this.vx) * this.frictionx, this.vy += (this.my - this.vy) * this.frictiony; for (var e = 0, s = this.$layers.length; s > e; e++) { var n = this.depthsx[e], o = this.depthsy[e], r = this.$layers[e], a = this.vx * (n * (this.invertx ? -1 : 1)), h = this.vy * (o * (this.inverty ? -1 : 1)); this.setposition(r, a, h) } this.raf = requestanimationframe(this.onanimationframe) }, n.prototype.ondeviceorientation = function(t) { if (!this.desktop && null !== t.beta && null !== t.gamma) { this.orientationstatus = 1; var e = (t.beta || 0) / r, s = (t.gamma || 0) / r, n = i.innerheight > i.innerwidth; this.portrait !== n && (this.portrait = n, this.calibrationflag = !0), this.calibrationflag && (this.calibrationflag = !1, this.cx = e, this.cy = s), this.ix = e, this.iy = s } }, n.prototype.onmousemove = function(t) { var i = t.clientx, e = t.clienty; ! this.orientationsupport && this.relativeinput ? (this.cliprelativeinput && (i = math.max(i, this.ex), i = math.min(i, this.ex + this.ew), e = math.max(e, this.ey), e = math.min(e, this.ey + this.eh)), this.ix = (i - this.ex - this.ecx) / this.erx, this.iy = (e - this.ey - this.ecy) / this.ery) : (this.ix = (i - this.wcx) / this.wrx, this.iy = (e - this.wcy) / this.wry) }; var h = { enable: n.prototype.enable, disable: n.prototype.disable, updatelayers: n.prototype.updatelayers, calibrate: n.prototype.calibrate, friction: n.prototype.friction, invert: n.prototype.invert, scalar: n.prototype.scalar, limit: n.prototype.limit, origin: n.prototype.origin }; t.fn[o] = function(i) { var e = arguments; return this.each(function() { var s = t(this), r = s.data(o); r || (r = new n(this, i), s.data(o, r)), h[i] && r[i].apply(r, array.prototype.slice.call(e, 1)) }) } } (window.jquery || window.zepto, window, document), function() { for (var t = 0, i = ["ms", "moz", "webkit", "o"], e = 0; e < i.length && !window.requestanimationframe; ++e) window.requestanimationframe = window[i[e] + "requestanimationframe"], window.cancelanimationframe = window[i[e] + "cancelanimationframe"] || window[i[e] + "cancelrequestanimationframe"]; window.requestanimationframe || (window.requestanimationframe = function(i, e) { var s = (new date).gettime(), n = math.max(0, 16 - (s - t)), o = window.settimeout(function() { i(s + n) }, n); return t = s + n, o }), window.cancelanimationframe || (window.cancelanimationframe = function(t) { cleartimeout(t) }) } ();