Giter Site home page Giter Site logo

Comments (9)

terwanerik avatar terwanerik commented on July 27, 2024 1

v1.0 is just released! Could you check if this issue still exists? Please note that the API has changed quite a bit.

from scrolltrigger.

terwanerik avatar terwanerik commented on July 27, 2024 1

The scroll-showCallback can now be set either as a global callback, e.g. triggering by default on all triggers, or when adding a certain set of triggers;

Global / default callback

const scrollTrigger = new ScrollTrigger({
  trigger: {
    toggle: {
      callback: {
        in: () => {
          // This is the same as setting a data-scroll-showCallback
          alert('in')
        },
        out: () => {
          // This is the same as setting a data-scroll-hideCallback
          alert('out')
        }
      }
    }
  }
})

scrollTrigger.add('[data-scroll]')

Only for certain triggers

const trigger = new ScrollTrigger()
// Add simple triggers, without callback
trigger.add('[data-scroll]')

// Add triggers to the ScrollTrigger, only with attribute `data-scrollWithCallback`
trigger.add('[data-scrollWithCallback]', {
  toggle: {
    callback: {
      in: () => {
        alert('in')
      },
      out: () => {
        alert('out')
      }
    }
  }
})

Adding some documentation for upgrading from 0.x to 1.x sounds like a good idea, i'll add that to the roadmap.

from scrolltrigger.

terwanerik avatar terwanerik commented on July 27, 2024 1

Added documentation on migrating from 0.x

from scrolltrigger.

vdorchan avatar vdorchan commented on July 27, 2024

I have the same problem

from scrolltrigger.

terwanerik avatar terwanerik commented on July 27, 2024

v1.0 is coming soon, this will fix this issue. I'm still working on it, but quite busy at the moment. I would love to support Vue.js and React out of the box, this still takes some work; but the 'basic' idea works perfectly.

If you are brave you can already use the current draft of 1.0 @ https://github.com/terwanerik/ScrollTrigger/tree/v1.0

from scrolltrigger.

ctlaux avatar ctlaux commented on July 27, 2024

I have the same problem. Is v1.0 around the corner? I don't mean to rush you, if it is farther off I will try and build my own, as you suggested. Thanks for the library btw.

from scrolltrigger.

Jeremboo avatar Jeremboo commented on July 27, 2024

I tried the v1.0 draft and it doesn't seem to work too. Any indications to try to fix this?

from scrolltrigger.

terwanerik avatar terwanerik commented on July 27, 2024

Updated the codepen to use v1.0.0, now works as expected.

https://codepen.io/erikterwan/pen/qBBMVXQ

from scrolltrigger.

ctlaux avatar ctlaux commented on July 27, 2024

Hmm, I'm not sure how to map my old config to the new API... I have various data-scroll-showCallback in my html file, where do I put these for the new API? Maybe this should be documented in more detail and specifically for switching versions...

from scrolltrigger.

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.