Jump to content
GreenSock

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

SplitText Function Call not working locally...

Recommended Posts

Guys, I don't understand this, using this simple splitText action inside a function, works fine on codepen but locally getting in browser console:

 

TypeError: undefined is not an object (evaluating 'a.length')

 

Any ideas? Set up is code in a local .js file correctly linked and working with other animations and html elements in index.html exactly as codepen example.

 

2 a.m. here so that might have something to do with it, not normally this dense...

 

Buzz

See the Pen mXdvQr by cfx (@cfx) on CodePen

Link to comment
Share on other sites

not really sure. are you running the same version of SplitText?

The CodePen one uses 0.5.8

 

Add this locally to test 

console.log(SplitText.version)

 

Link to comment
Share on other sites

7 hours ago, Carl said:

not really sure. are you running the same version of SplitText?

The CodePen one uses 0.5.8

 

Add this locally to test 


console.log(SplitText.version)

 

 

Just done that Carl, reports 0.5.8..

Link to comment
Share on other sites

I've turned off all scripts except

js/SplitText.min.js

https://...../libs/gsap/1.20.3/TweenLite.min.js

https://..../libs/gsap/1.20.3/TimelineLite.min.js

 

and my working script but have commented out everything except the splitText function I posted. The problem can only be either the local environment, the splitText function or the html!

 

:shock:

 

Buzz

Link to comment
Share on other sites

Ok, clearly never do things at 2 a.m. - turns out my index.js was ref'd in the head so of course it wasn't picking up the string elements on the page before the script ran.

 

doh.

 

Hope this maybe helpful to other late night developers. Now where's my coffee..

 

Thanks Carl.

 

Buzz

  • Like 1
Link to comment
Share on other sites

Well, glad it was something simple.

Don't worry, we've all been in similar situations. Its part of the developer's life. :mrgreen:

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.
×