Jump to content
Search Community

timduncan

Members
  • Posts

    1
  • Joined

  • Last visited

timduncan's Achievements

  1. Hello, I am quite stuck with something and could really use a pair of extra eyes for the following code: gsap.to(wrapperRef.current, { scrollTrigger: { trigger: wrapperRef.current, pin: imgWrapRef.current, pinSpacing: true, start: "top top", end: "bottom bottom", scrub: true, markers: false, onUpdate: ({ progress }) => { if (progress > 0.5) { console.log(imgWrapRef.current) document.querySelector('img').setAttribute("data-hide", "true") } else { document.querySelector('img').setAttribute("data-hide", "false") } } } }) and I can feel its so simple, but still can't understand why my console.log returns null. so basically I am in another scope and onUpdate doesn't know what's my ref. does anyone have a suggestion of what's the fix? thanks a lot in advance.
×
×
  • Create New...