ParallaxWrapper

ParallaxWrapper

Example

index.tsx
import { ParallaxWrapper } from "@nguyend-nam/scrollery-ts";
import "./styles.css";
 
export default function ParallaxWrapperDemo() {
  return (
    <div className="layout">
      <h1 className="heading">
        <code>ParallaxWrapper</code>
      </h1>
 
      <div className="message">
        <p>Start scrolling</p>
      </div>
 
      <div className="container">
        <ParallaxWrapper layer={-5} className="item-wrapper">
          <div className="item item-1" />
        </ParallaxWrapper>
 
        <ParallaxWrapper layer={0} className="item-wrapper">
          <div className="item item-2" />
        </ParallaxWrapper>
 
        <ParallaxWrapper layer={5} className="item-wrapper">
          <div className="item item-3" />
        </ParallaxWrapper>
      </div>
    </div>
  );
}

API

NameTypeDefaultDescriptionRequired
childrenJSX.ElementThe single component for the content you want to animate on scroll
styleCSSPropertiesThe styles you want to apply to the wrapper
classNamestringThe classes you want to apply to the wrapper
layernumber0The parallax layer, the larger the value, the faster content transitions
thresholdnumber200The threshold (in pixels) to start applying the transition when the content enter/leave the viewport