Coder Social home page Coder Social logo

Comments (3)

jslyonnais avatar jslyonnais commented on June 20, 2024 1

Finally found a workaround.
You got right about Gatsby, but I was thinking if I can find a way to make things work.

Comment for futur people, finally I've use scrollama directly from npm, and call it on the componentDidMount of react.

componentDidMount() {
    // Loading module that require "window" to be defined
    require('intersection-observer')
    const scrollama = require('scrollama')

    const scrollThreshold = 0.33
    const scroller = scrollama()
    scroller.setup({
      // debug: true,
      step: '.scroll__step',
      threshold: scrollThreshold,
      container: '.scroll__container',
      graphic: '.scroll__graphic'
    }).onStepEnter(this.handleScrollStepEnter)
  }

from react-scrollama.

NicholasLYang avatar NicholasLYang commented on June 20, 2024

Just clarifying, this is code executed by the browser, correct? Because Gatsby is a server side renderer, so if you're rendering on node, window won't be defined. Just want to make sure we're on the same page.

from react-scrollama.

NicholasLYang avatar NicholasLYang commented on June 20, 2024

Great! Thanks for posting your solution.

from react-scrollama.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.