Benny
Content Type
Profiles
Forums
Store
Blog
Product
Showcase
FAQ
Downloads
Posts posted by Benny
-
-
Hi everyone,
I'm new at all this, and just finally hopped onboard gsap with the ScrollTrigger plugin release. But now I've run into a basic installation issue and can't seem to find similar in the forums.
This is the only code I've left uncommented for gsap:
window.onload = function(){//timeline functions//HOME PAGE CONDITIONif( ishome() ) {//Scroll */gsap.registerPlugin(ScrollTrigger);At the registration call. And the code inside indicates that the body element is undefined:
So the problem isn't likely the source files or body tag. The environment is a wordpress install and the files are called with the following enqueue function. As a result of all this trail and error I've tried unminified versions, I've run the files locally instead of CDN, and included map files when calling minified files. I'm running out of ideas.
function neon_enqueue(){wp_enqueue_style( 'neon-css', get_template_directory_uri() . '/dist/css/style.css', array(), '1.0.0', 'all' );//wp_enqueue_script( 'greensock', 'https://cdnjs.cloudflare.com/ajax/libs/gsap/3.3.0/gsap.min.js', array(), '3.3', false );wp_enqueue_script( 'greensock', get_template_directory_uri() . '/dist/js/gsap.min.js', array(), '3.3', false );wp_enqueue_script( 'scrolltrigger', 'https://cdnjs.cloudflare.com/ajax/libs/gsap/3.3.0/ScrollTrigger.js', array('greensock'), '3.3', false );wp_enqueue_script( 'theme-js', get_template_directory_uri() . '/dist/js/theme.js', array(), '1.0.0', false);wp_enqueue_script( 'footer-js', get_template_directory_uri() . '/dist/js/footer.js', array('gs-animation-library'), '1.0.0', true);}I know this is a local environmental issue and not reproducible, but it has to be something really simple I'm not understanding right.
Anyone have some insight here?
Thanks!
Problem with gsap.registerPlugin(ScrollTrigger) in WordPress
in GSAP
Posted
It was simple. So simple that I'm not sure I should leave the post up but for fellow WP devs just setting this up who load libraries in the header, the ScrollTrigger actually runs the dom so always enqueue in the footer.
Not sure if that was mentioned in the docs or not. If it was I missed it.