nextjs-with-locomotive-scroll-example icon indicating copy to clipboard operation
nextjs-with-locomotive-scroll-example copied to clipboard

Use without data-scroll-container

Open opr-inzn opened this issue 2 years ago • 0 comments

I'm also using GSAP’s scrolltrigger which does not allow for the use of any data-scroll attributes. If I remove data-scroll-container from _app.tsx, however, it breaks the Locomotive Scroll and returns "Cannot read properties of null (reading 'offsetHeight'). I have instead already applied the "el" option:

<LocomotiveScrollProvider
        options={{
          el: containerRef.current,
          smooth: true,
        smartphone: {
          smooth: true,
        },
        tablet: {
          smooth: true,
        },
        }}
        watch={[]}
        location={asPath}
      onLocationChange={(scroll: any) =>
        scroll.scrollTo(0, { duration: 0, disableLerp: true })
      }
      
      containerRef={containerRef}
      >
              <div ref={containerRef}>

but that doesn't seem to work either. Is there another way?

opr-inzn avatar Jan 06 '23 10:01 opr-inzn