You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use the plugin as described in the example project I get this error in the console.
[Error] TypeError: undefined is not an object (evaluating 'this.rootElement.getAttribute')
ScrollSnap (scroll-snap.js:14)
Modulcode (Lenis.astro:15)
When looking at the code in scroll-snap.js I see that it calls this.lenis.wrapperNode and this.lenis.contentNode which do not seem to be available in recent versions of lenis at least. I replaced them with lenis.options.wrapper and lenis.options.content, which made the error disappear.
constructor(lenis,{ snapType }){this.lenis=lenis;this.isHorizontal=this.lenis.direction==="horizontal";// we can set different value in case we need snap for different axis.this.rootElement=this.lenis.options.wrapper===window
? this.lenis.options.content
: this.lenis.options.wrapper;this.snapType=snapType||this.rootElement.getAttribute("scroll-snap-type")||"mandatory";this.initElements();lenis.on("scroll",this.onScroll);}
The text was updated successfully, but these errors were encountered:
hrvstr
changed the title
Example code outdated?
constructor outdated?
May 19, 2023
We actually have two branches. One for the old Lenox version, and one for the new version. Try the other branch and let me know if that works or not. Thanks for trying it out!
Ah sorry, I didn't notice the different branches. I tried the 1.0 branch now and got the same error. In the code, I still see references to this.lenis.wrapper.element for example. Thanks for your great work. I am actually using a custom version now that works pretty well.
When I use the plugin as described in the example project I get this error in the console.
When looking at the code in
scroll-snap.js
I see that it callsthis.lenis.wrapperNode
andthis.lenis.contentNode
which do not seem to be available in recent versions of lenis at least. I replaced them withlenis.options.wrapper
andlenis.options.content
, which made the error disappear.The text was updated successfully, but these errors were encountered: