Setup
Chapter 2Scripts go at the bottom of the body so the page loads first. GSAP first and your own code right after it.
<script src="https://cdn.jsdelivr.net/npm/gsap@3.13.0/dist/gsap.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/gsap@3.13.0/dist/ScrollTrigger.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/gsap@3.13.0/dist/SplitText.min.js"></script> <script> gsap.registerPlugin(ScrollTrigger); gsap.registerPlugin(SplitText); console.log(gsap.version); </script>
gsap.min.js- GSAP itself so it always loads first
ScrollTrigger.min.js- a plugin and only the file name changes
gsap.registerPlugin()- tells GSAP the plugin exists so it can use it
console.log(gsap.version)- prints 3.13.0 when GSAP is loaded
Watch outgsap is not defined means your script sits above the GSAP one. Move it below and refresh.