diff --git a/src/index.tsx b/src/index.tsx index 44ad859..ba8e8c0 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -243,17 +243,16 @@ export default class InfiniteScroll extends Component { const threshold = parseThreshold(scrollThreshold); + if (threshold.unit === ThresholdUnits.Pixel) { return ( - target.scrollTop <= - threshold.value + clientHeight - target.scrollHeight + 1 || + target.scrollTop <= threshold.value || target.scrollTop === 0 ); } return ( - target.scrollTop <= - threshold.value / 100 + clientHeight - target.scrollHeight + 1 || + target.scrollTop <= ((100 - threshold.value) / 100) * clientHeight || target.scrollTop === 0 ); }