Wordpress Discussion
Out of context: Reply #27
- Started
- Last post
- 164 Responses
- dee-dubs0
Here's one Im stuck on. Trying to use ScrollMagic and GSAP in WP to do a little animation on scrolling... cant get the b@st@rd$ to work.
Am adding the scripts in my functions like:
function my_theme_scripts_function() {
wp_enqueue_script( 'gsap-js', 'http://cdnjs.cloudflare.com/aja... array(), false, true );
wp_enqueue_script( 'scrollmagic-js', 'http://cdnjs.cloudflare.com/aja... array(), false, true );
wp_enqueue_script( 'myscript', get_template_directory_uri() . '/js/scripts.js', array(), false, true);
}then just for testing have tried in my scripts file:
var controller = new ScrollMagic.Controller();
var myTest = new ScrollMagic.Scene({duration: 200})
.triggerElement('#hero1')
.setTween(testTween)
.addIndicators()
.addTo(controller);and i keep getting :
scripts.js?ver=4.5.3:33 Uncaught TypeError: (intermediate value).triggerElement(...).setTw... is not a function
any ideas ? I tried adding 'gsap-js' as a dependency for ScrollMagic and that did nothing.. really stumped on this
- PASTE.
BIN.ArmandoEstrada - Quick stab, remove the http: and https:ArmandoEstrada
- http://pressing-matt…ArmandoEstrada
- No dice, tried removing http no differencedee-dubs
- Check console and make sure that those scripts are in fact being loaded. The "is not a function" error is indication that either they are not linked correctly,yuekit
- or your scripts.js function is executing before they have loaded.yuekit
- scripts are loading, and I have the script.js function firing on window.load so they should all be runningdee-dubs
- It was addIndicators() if you use that you need to be loading scrollMagic debug JS too!dee-dubs
- PASTE.