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

@concarne/react-scroll-fade

v0.0.1

Published

React component for scrolling to images with fade in and out

Downloads

21

Readme

react-scroll-fade

React component for scrolling to images with fade in and out.

demo

The only export is the ImageWithFadein component. It renders a hidden image at a desired breakpoint (scrollTo) below the viewport, and when scrolled down to, fixes it to the desired position (imageTop) and unhides it with a ease-in animation. The image will hide again when scrolling up above the breakpoint.

The component takes care of smoothly transitioning to and from the image, so there are no jitters or hops when the image becomes visible. Just a nice and easy fade-in/out.

Usage

import { ImageWithFadein } from 'react-scroll-fade';

const App = () => {
  const imageSrc = './path/to/image.png|gif|jpg|etc';
  return () => {
    <ImageWithFadein
      src={imageSrc}
      centerOffset={-5}
      scrollTo={250}
      imageTop={80}
    />
  }
};

ImageWithFadein uses the CSS viewheight unit to position itself. It is best to set the height of the page in viewheight units vh to be greater than what the scrollTo prop is set to (the image height should be considered as well). This ensures that the image can actually be scrolled to.

Props

  • src url of image
  • height height of image
  • width width of image
  • scrollTo position in vh of image before coming into view. For best results, this should be greater than 100
  • imageTop fixed position in vh of image when in view. The top of the image will be at this position in the viewport. For best results, this should be between 0 and 100
  • centerOffset default: 0 % of viewwidth off center (0) with left offset - and right offset +. By default, the image is centered. Use this prop to position it horizontally.

Future

  • Implement ImageWithFadein using IntersetionObserver API
  • Add a non-fixed option
  • Add a end-fixed-after-scroll option
  • Add different animation types
  • Allow control of animations