react-keep-visible

2.0.1 • Public • Published

React Keep Visible

React Keep Visible [BETA]

Keep an element in the viewport (within the bounds of its parent container) while the user scrolls.

Similar to position 'sticky', except it intelligently switches between sticking to the top and bottom edge to allow scrolling through the entire element.

live demo

Vanilla sticky counter example: demo

Installation

npm install react-keep-visible

or

yarn add react-keep-visible

Usage

      <KeepVisible>
        [ element ]
      </KeepVisible>

Notes

To do: support 'top' & 'bottom' offsets.

Margins added to the element kept visible will negatively impact positioning. Try padding instead.

Readme

Keywords

Package Sidebar

Install

npm i react-keep-visible

Weekly Downloads

79

Version

2.0.1

License

MIT

Unpacked Size

12.4 kB

Total Files

7

Last publish

Collaborators

  • gregarcher