@mangoweb/parallax
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -8,3 +8,3 @@ import { Component } from '@mangoweb/scripts-base'; | ||
init(): void; | ||
onScroll: () => void; | ||
update: () => void; | ||
getElementYCenter: () => number; | ||
@@ -11,0 +11,0 @@ } |
@@ -26,3 +26,3 @@ "use strict"; | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this.onScroll = function () { | ||
_this.update = function () { | ||
var reachDistance = window.innerHeight * PARALLAX_REACH; | ||
@@ -39,4 +39,4 @@ var offset = clamp(-1, (_this.getElementYCenter() - (window.scrollY + window.innerHeight / 2)) / reachDistance, 1); | ||
Parallax.prototype.init = function () { | ||
window.addEventListener('scroll', this.onScroll, { passive: true }); | ||
this.onScroll(); | ||
light_bounds_1.lightBounds(this.el, this.update); | ||
this.update(); | ||
}; | ||
@@ -43,0 +43,0 @@ Parallax.componentName = 'Parallax'; |
{ | ||
"name": "@mangoweb/parallax", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Watches elements vertical position in viewport.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -18,7 +18,7 @@ import { Component } from '@mangoweb/scripts-base' | ||
init() { | ||
window.addEventListener('scroll', this.onScroll, { passive: true }) | ||
this.onScroll() | ||
lightBounds(this.el, this.update) | ||
this.update() | ||
} | ||
onScroll = () => { | ||
update = () => { | ||
const reachDistance = window.innerHeight * PARALLAX_REACH | ||
@@ -25,0 +25,0 @@ const offset = clamp(-1, (this.getElementYCenter() - (window.scrollY + window.innerHeight / 2)) / reachDistance, 1) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6644