Sanady Posted October 20, 2020 Share Posted October 20, 2020 Hello guys, I have small issue with gsap ScrollTo function. I don`t know why but after every transition I get around 40 errors -> "Uncaught TypeError: Failed to execute 'scrollTo' on 'Element': cannot convert to dictionary.". I don`t know why, I don`t even use scrollTo function in my JS file... Can you help me? Screenshot is in uploaded media. I also posted my JS file on pastebin: https://pastebin.com/JHjZZUNT Thanks in advanced. Link to comment Share on other sites More sharing options...
akapowl Posted October 20, 2020 Share Posted October 20, 2020 Hey @Sanady - welcome to the forums. That most likely is related to how things work with barba. Whenever you transition between pages, barba gets rid off the old content and adds in new content. My guess would be that you init your scrollTo function only once on page load. That would result in it only knowing the contents that are in place at that time and none of the contents that will be added in later on. Thus it has nothing to relate to after you transitioned and things result in errors. You'd probably have to wrap your scrollTo-functionality inside a function, and init that function in a barba hook every time you enter a new page (and best, also destroy it in some way for the old content when leaving a page). Hope this helps. Cheers, Paul 1 Link to comment Share on other sites More sharing options...
ZachSaucier Posted October 20, 2020 Share Posted October 20, 2020 If you'd like our help debugging please create a minimal version of the issue and share those files with us. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now