npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

reactstickyjs

v1.0.1

Published

ReactStickyJS is a JS library for making an element sticky with respect to window during page scroll and it also provide the break stickiness of the element when we want it to, in case other more prioritise element touches it.

Downloads

4

Readme

ReactStickyJS

ReactStickyJS is a JS library for making an element sticky with respect to window during page scroll and it also provide the break stickiness of the element when we want it to, in case other more prioritise element touches it.

Why we need this module

We have sticky property in CSS to manage sticky but its deprecated for IE and Edge browsers, also it doesn't provide us the feature of breaking stickiness when other element touches it.

Installation

npm install --save reactstickyjs

Usage

import ReactStickyJS from 'ReactStickyJS';

<ReactStickyJS 
  refDiv='containerRef'
  top='100'
>
 Hi,I am a container which is placed at 100px from top and will get stick to the top of window on scroll. 
</ReactStickyJS>

Props

  children: PropTypes.node.isRequired,
  refDiv: PropTypes.string.isRequired,
  className: PropTypes.string,
  top: PropTypes.number,
  isBreakSticky: PropTypes.bool,
  breakRefDiv: PropTypes.string,
  activeMobile: PropTypes.bool,
  activeTablet: PropTypes.bool,
  mobileTop: PropTypes.number,
  tabletTop: PropTypes.number,
  extraTop: PropTypes.number,
  extraMobileTop: PropTypes.number,
  extraTabletTop: PropTypes.number,
  initialPosition: PropTypes.string,
  mobileBreakpoint: PropTypes.number,
  tabletBreakpoint: PropTypes.number,

DefaultProps

  className: '',
  top: 0,
  isBreakSticky: false,
  breakRefDiv: '',
  activeMobile: false,
  activeTablet: false,
  mobileTop: 0,
  tabletTop: 0,
  extraTop: 0,
  extraMobileTop: 0,
  extraTabletTop: 0,
  initialPosition: 'fixed',
  mobileBreakpoint: 767.5,
  tabletBreakpoint: 991.5,

Props Explanation

  children: This contains all the elements reside inside the wrapper.

  refDiv: Its a reference id for the sticky wrapper.

  className: Pass a dynamic class which will apply the css to the wrapper.

  top: This is the initial position of your refDiv from the top of window.

  isBreakSticky: Set true if you want to break the stickiness of your main refDiv when other div like footer, etc, touches it.

  breakRefDiv: Its a reference id for the element which breaks the stickiness of main refDiv on touching it.

  activeMobile: Set true to activate sticky behaviour on mobile.

  activeTablet: Set true to activate sticky behaviour on mobile.

  mobileTop: This is the initial position of your refDiv from the top of window on mobile.

  tabletTop: This is the initial position of your refDiv from the top of window on mobile.

  extraTop: This is the distance from top where you want to stick the refDiv.

  extraMobileTop: This is the distance from top where you want to stick the refDiv on mobile.

  extraTabletTop: This is the distance from top where you want to stick the refDiv on tablet.

  initialPosition:  Set the initial css property for position here if you do not want it fixed.

  mobileBreakpoint: Breakpoint where viewport changes to mobile.

  tabletBreakpoint: Breakpoint where viewport changes to tablet.

License

ISC