Brian Barrus
Brian Barrus

Reputation: 515

Vivus.js Script won't execute in WordPress

I'm trying to use the Vivus.js script in wordpress to animate my svg logo drawing. It is loading the js file but in the error console I'm getting: SyntaxError: Unexpected token '<' referencing the first line of the virus.js file.

Here is my script from the Wordpress Footer.php:

var elogo = new Vivus('elogo', {
    type : 'delayed',
    duration : 140,
    start : 'autostart',
    forceRender : true,
    dashGap: 20
}, function() {
    if (window.console) {
        console.log('Animation finished. [log triggered from callback]');
    }
})

Everything is working outside of WordPress but when I put it in my theme files it won't execute the animation.

My page address is http://entrepology.studio-element.com

Upvotes: 1

Views: 1242

Answers (1)

Fred
Fred

Reputation: 3362

The path is wrong. Your page is linking to:

<script src="http://entrepology.studio-element.com/wp-content/themes/entrepology/js/dist/vivus.js"></script>

If you paste the URL in the browser it redirects to your home page. The first line of HTML is:

<!DOCTYPE html>

And this is causing the error. So all you have to do is to fix the path. Check your header.php or the functions.php (or any other place where you enqueue your script).

Edit: I tried a few other paths. This one should work (the dist is too much):

http://entrepology.studio-element.com/wp-content/themes/entrepology/js/vivus.js

Upvotes: 1

Related Questions