How to use scrollama - 6 common examples

To help you get started, we’ve selected a few scrollama examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github googlefonts / korean / app / components / DescriptionEn.js View on Github external
componentDidMount(){
    
    this.scroller = scrollama();

    this.scroller.setup({
        step: '.desc-column-area',
        // debug: true,
        // progress: true,
        offset: (window.innerHeight - 150) / window.innerHeight,
      }).onStepEnter(this.handleStepEnter.bind(this))
        // .onStepProgress(this.handleStepProgress.bind(this))
        // .onStepExit(this.handleStepExit.bind(this));
  }
github mozilla / donate-wagtail / source / js / components / waypoint-detection.js View on Github external
function scrollamaInit() {
  // instantiate the scrollama
  const scroller = scrollama();

  // setup the instance, pass callback functions
  scroller
    .setup({
      step: ".js-data-waypoint",
    })
    .onStepEnter((response) => {
      document
        .querySelectorAll("[data-waypoint-element]")
        .forEach((stepItem) => {
          stepItem.classList.add("hidden");
        });
    });
}
github googlefonts / korean / app / components / GoogleFontBadge.js View on Github external
componentDidMount(){
    let { screenHeight } = this.props;
    
    this.scroller = scrollama();
    this.footerScroller = scrollama();


    this.footerScroller.setup({
      step: '.footer',
      offset: (screenHeight - 80) / screenHeight,
    }).onStepEnter(this.handleFooterEnter.bind(this))
        .onStepExit(this.handleFooterExit.bind(this));


    this.scroller.setup({
        step: '.description-footer',
        // progress: true,
        offset: (screenHeight - 69) / screenHeight 
      }).onStepEnter(this.handleStepEnter.bind(this))
        // .onStepProgress(this.handleStepProgress.bind(this))
github umijs / father-doc / packages / umi-plugin-father-doc / src / themes / default / layout.tsx View on Github external
initializeScrollma() {
    // instantiate the scrollama
    this.scrollama = scrollama();
    const { slugs = [] } = this.getMetaForCurrentPath();

    // setup the instance, pass callback functions
    this.scrollama
      .setup({
        step: '[id]',
        offset: 0.01,
      })
      .onStepEnter(response => {
        const { element } = response;
        if (slugs.map(ele => ele.heading).includes(element.id)) {
          this.setState({ localActive: element.id });
        }
      });

    // setup resize event
github googlefonts / korean / app / components / HeaderCollapsed.js View on Github external
constructor(props){
    super(props);

    this.scroller = scrollama();
    this.state = {
      isMenuOpen: false
    };
  }
github googlefonts / korean / app / components / App.js View on Github external
constructor(props){
    super(props);
    this.handleResize = this.handleResize.bind(this);
    this.handleScroll = this.handleScroll.bind(this);

    this.headerTopScale = scaleLinear().domain([62, 0]).clamp(true).range([0, -62]);

    this.scroller = scrollama();
    this.handleBodyClick = this.handleBodyClick.bind(this);
  }

scrollama

Lightweight scrollytelling library using IntersectionObserver

MIT
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis

Popular scrollama functions