@sveltejs/svelte-scroller
Advanced tools
Comparing version 1.0.4 to 1.0.5
# svelte-scroller changelog | ||
## 1.0.5 | ||
* Handle case where scroller abruptly disappears from viewport | ||
## 1.0.4 | ||
@@ -4,0 +8,0 @@ |
23
index.js
@@ -188,2 +188,3 @@ (function (global, factory) { | ||
} else { | ||
scroller.handleScroll(); | ||
if (index !== -1) scrollers.splice(index, 1); | ||
@@ -271,6 +272,2 @@ } | ||
// only update while the foreground is visible | ||
// (only affects browsers without IntersectionObserver) | ||
if (foreground.top > window.innerHeight || foreground.bottom < 0) return; | ||
const foreground_height = foreground.bottom - foreground.top; | ||
@@ -306,14 +303,14 @@ const background_height = background.bottom - background.top; | ||
fixed = true; | ||
} | ||
for (index = 0; index < this.sections.length; index += 1) { | ||
const section = this.sections[index]; | ||
const { top } = section.getBoundingClientRect(); | ||
for (index = 0; index < this.sections.length; index += 1) { | ||
const section = this.sections[index]; | ||
const { top } = section.getBoundingClientRect(); | ||
const next = this.sections[index + 1]; | ||
const bottom = next ? next.getBoundingClientRect().top : this.refs.foreground.getBoundingClientRect().bottom; | ||
const next = this.sections[index + 1]; | ||
const bottom = next ? next.getBoundingClientRect().top : this.refs.foreground.getBoundingClientRect().bottom; | ||
if (bottom >= threshold_px) { | ||
offset = (threshold_px - top) / (bottom - top); | ||
break; | ||
if (bottom >= threshold_px) { | ||
offset = (threshold_px - top) / (bottom - top); | ||
break; | ||
} | ||
} | ||
@@ -320,0 +317,0 @@ } |
{ | ||
"name": "@sveltejs/svelte-scroller", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "A <Scroller> component for Svelte apps", | ||
@@ -5,0 +5,0 @@ "svelte": "src/Scroller.html", |
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
36556
804