UNPKG

@haxtheweb/haxcms-nodejs

Version:

HAXcms single and multisite nodejs server, api, and administration

11 lines 1.42 kB
/** @license Copyright (c) 2016 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ import"../app-scroll-effects-behavior.js";import{ElementWithBackground as a,registerEffect as r}from"../../helpers/helpers.js";r("parallax-background",{setUp:function setUp(a){var r={},t=parseFloat(a.scalar);r.background=this._getDOMRef("background"),r.backgroundFrontLayer=this._getDOMRef("backgroundFrontLayer"),r.backgroundRearLayer=this._getDOMRef("backgroundRearLayer"),r.deltaBg=r.backgroundFrontLayer.offsetHeight-r.background.offsetHeight,0===r.deltaBg?(isNaN(t)&&(t=.8),r.deltaBg=(this._dHeight||0)*t):(isNaN(t)&&(t=1),r.deltaBg=r.deltaBg*t),this._fxParallaxBackground=r},run:function run(a,r){var t=this._fxParallaxBackground;this.transform("translate3d(0px, "+t.deltaBg*Math.min(1,a)+"px, 0px)",t.backgroundFrontLayer),t.backgroundRearLayer&&this.transform("translate3d(0px, "+t.deltaBg*Math.min(1,a)+"px, 0px)",t.backgroundRearLayer)},tearDown:function tearDown(){delete this._fxParallaxBackground}});