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

Share this post


Link to post
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)

 

Share this post


Link to post
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..

Share this post


Link to post
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

Share this post


Link to post
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:

Share this post


Link to post
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.