I have code from a Codepen that I’d like to base my project from but I when I play this from VS Code I get an error that says lottie is not defined
. I have all the libraries in Codepen loaded from script
elements in the VS Code’s html header, everything in VS Code is inline with the Codepen as far as I tell.
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.container {
display: flex;
margin: auto;
width: 50vh;
height: 50vh;
background-color:'#000000'
}
</style>
<title>Document</title>
<script src="https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js"></script>
<script src="https://unpkg.com/@lottiefiles/lottie-interactivity@latest/dist/lottie-interactivity.min.js"></script>
<script src=”https://cdnjs.cloudflare.com/ajax/libs/bodymovin/5.7.11/lottie.min.js”></script>
</head>
Will anyone catch what I’m missing? Thanks in advance.
2
Answers
I'm using "fancy" quotes in my links, this is why my
bodymovin
library doesn't run. Javascript simply doesn't recognize the code like it would not a comment.Reference to your codepen example check the following code which works smooth on VS code without any error.
Note: Always use updated CDN script