Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Sanady

scrollTo -> Failed to execute

Recommended Posts

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.

yogapit.png

Link to comment
Share on other sites

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

  • Like 1
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×