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

react-scroll-jacker

v1.8.4

Published

ruthless scroll jacking component that takes no ransom. The component makes scrolling certain distance have the effect of changing a page (instead of.. scrolling the page). Under the hood, it takes React Children and shows them one by one, depending on th

Downloads

139

Readme

React Scroll Jacker

React Scroll Jacker is a component that makes your next scroll-hijacking easy! Instead of using scroll to scroll the page like a sane person, this component lets you use scroll to transition between React elements. Users` hijacked scrolls will return after they spin their mousewheels as many times as you have arbitrarily dictated.

Now sit back and enjoy sweet tears of UX designers and users.

Demo

Installation

$ npm install --save react-scroll-jacker

Usage

  1. Add Elements to <ReactScrollJacker> as its children.
  2. (optional) set the scroll sensitivity
  3. Sit back and enjoy scroll-jacking.
import ReactScrollJacker from "react-scroll-jacker";

const ScrollerJackerTest = props => {
  return <ReactScrollJacker> 
      <ReactElement color="red"> Help! </ReactElement> 
      <ReactElement color="blue"> Our scroll has been hijacked! </ReactElement> 
      <ReactElement color="purple"> Wont somebody please think of the UX ? </ReactElement>
      <ReactElement color="green"> UX?? Where we are going, we dont need UX. </ReactElement>
      
      {/* you can add any number of ReactElements in here !! */}
    </ReactScrollJacker>
};

Elements show in the order they are added in.

Props

scrollSensitivity (number[1-9]: optional)

Decides how sensitive the scrolls are. Lower the number, more you have to scroll to transition to the next element. The default value is 7.

stickyOffset (number: optional)

this sets the offset of the stickied element from the top of the viewbox.

injectChildren (optional)

This will inject the React.Children with props currentPage which returns the index of the currently rendered child and progress which returns a float between 0 and 1 representing the current progress to the next transition, 1 being 100% (Enabling this calls setState every time you scroll, adding the icing that is bad performance to the frustration cake)

  <ReactScrollJacker injectChildren height>
    <ReactElementOne> Help! </ReactElementOne>  
    <ReactElementOne> I did not ask for this! </ReactElementOne>
  </ReactScrollJacker>

   // Both ReactElementOnes will have get a prop currentPage that has the index of the current rendered child. 

This component is a regular div. style and className props are exposed. Style it however you wish.

Under the hood

This component uses stickybits to make child elements sticky. Stickybits uses css property sticky as a default and provides fallback via JS for browsers that are not supported.

Todo

  • [ ] Add Tests & webpack.
  • [x] Add Demo.
  • [ ] Add an option to pass down inject and not hide the children automatically.
  • [ ] apologise to the UX designers and users.

Patchnotes

v0.1.5

  • Now able to pass the progress to the next transition as a prop progress it returns a float between 0 and 1, 1 being 100%.
  • This can be used to give some kind of visual feedback of progress to users and make scroll-jacking a bit more bearable (but at the cost of performance :))