Unexpected token '<' - sometimes...

Solved
New Member
13 0 0

I uploaded a min.js file to the assets and in my theme.liquid file, I added the line

 

 

{{ 'parallax.min.js' | asset_url | script_tag }}

after the jquery.min.js file in the <head></head>..

 

 

I added the following to a page, to initiate the js - 

<script>
	new parallax().init();
</script>

Sometimes I get an error from chrome though: Uncaught SyntaxError: Unexpected token '<'

 

What am I doing wrong? Was I suppose to add it to the theme.js file? And if so, do I just add the line without the <script></script> to the theme.js file?

 

At the moment, it works some of the times (kind of.. still floats above my content but at least it shows).

0 Likes

Success.

Hello @Rachella,

If you added below code in theme.js file

<script>
	new parallax().init();
</script>

Then no need to add <script> and </script>

 

Remove <script> tag and only add below code

new parallax().init();

 

 

Want to modify or incorporate custom changes on store, Hire us.
If helpful then please Like and Accept Solution .
Email: pallavi@oscprofessionals.com
Skype : oscprofessionals-87
Free Review and advice for sale on store | Shopify Private App | Custom Theme Development | Custom Modifications In To Shopify Theme | SEO & Digital Marketing | Site Speed Optimization | Performance Site Audit
0 Likes
New Member
13 0 0

Thanks @oscprofessional for quick response - but even after removing it from a page and to the theme.js with just the one line of code - the error still shows up... Do I need to wrap it in something?

0 Likes
New Member
13 0 0

Sorry - I spoke too soon. I think I just needed to give it time to refresh as it works fine now. Thank you!

0 Likes