From a9ced2e2815cab8d528b8590647d9e9974e16d64 Mon Sep 17 00:00:00 2001 From: abramenal Date: Thu, 11 Mar 2021 16:50:24 +0100 Subject: [PATCH] docs: update "bottomOffset" description --- README.md | 10 +++++++++- index.d.ts | 10 +++++++++- src/waypoint.jsx | 9 ++++++++- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 445b38c..922a114 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,15 @@ enters or leaves the viewport. For details, see [Children](#children), below. ]), /** - * `bottomOffset` is like `topOffset`, but for the bottom of the container. + * `bottomOffset` can either be a number, in which case its a distance from the + * bottom of the container in pixels, or a string value. Valid string values are + * of the form "20px", which is parsed as pixels, or "20%", which is parsed + * as a percentage of the height of the containing element. + * For instance, if you pass "20%", and the containing element is 100px tall, + * then the waypoint will be triggered when it has been scrolled 20px beyond + * the bottom of the containing element. + * + * Similar to `topOffset`, but for the bottom of the container. */ bottomOffset: PropTypes.oneOfType([ PropTypes.string, diff --git a/index.d.ts b/index.d.ts index ff466ab..a51e603 100644 --- a/index.d.ts +++ b/index.d.ts @@ -79,7 +79,15 @@ declare namespace Waypoint { topOffset?: string|number; /** - * `bottomOffset` is like `topOffset`, but for the bottom of the container. + * `bottomOffset` can either be a number, in which case its a distance from the + * bottom of the container in pixels, or a string value. Valid string values are + * of the form "20px", which is parsed as pixels, or "20%", which is parsed + * as a percentage of the height of the containing element. + * For instance, if you pass "20%", and the containing element is 100px tall, + * then the waypoint will be triggered when it has been scrolled 20px beyond + * the bottom of the containing element. + * + * Similar to `topOffset`, but for the bottom of the container. */ bottomOffset?: string|number; diff --git a/src/waypoint.jsx b/src/waypoint.jsx index ef78f2d..e134896 100644 --- a/src/waypoint.jsx +++ b/src/waypoint.jsx @@ -346,7 +346,14 @@ if (process.env.NODE_ENV !== 'production') { PropTypes.number, ]), - // `bottomOffset` is like `topOffset`, but for the bottom of the container. + // `bottomOffset` can either be a number, in which case its a distance from the + // bottom of the container in pixels, or a string value. Valid string values are + // of the form "20px", which is parsed as pixels, or "20%", which is parsed + // as a percentage of the height of the containing element. + // For instance, if you pass "20%", and the containing element is 100px tall, + // then the waypoint will be triggered when it has been scrolled 20px beyond + // the bottom of the containing element. + // Similar to `topOffset`, but for the bottom of the container. bottomOffset: PropTypes.oneOfType([ PropTypes.string, PropTypes.number,