Open nitrokevin opened 6 years ago
You want to make sure your injected SVGs are loaded before controller is added. So wrap your scrollmagic related code in a function and call that function once the SVGs are injected. Like:
var mySVGsToInject = document.querySelectorAll('img.inject-me'); SVGInjector(mySVGsToInject, injectorOptions, function (totalSVGsInjected) { STARTanimation(); });
I got help on a similar issue in 2015 and there is a codepen:
https://greensock.com/forums/topic/11909-iconic-svginjector-preventing-gsap-animations/
Thanks so much I'll give it a go now
Am I right in thinking you need to use SVGInjector.js for this to work? the wordpress plugin is already handling the inlining so I guess I need to get it to make sure the injected code is loaded first
I am trying to animate svg’s that have been uploaded to WordPress media library, I have found a plugin (svg support) that automatically inlines the svg file so you can target the code, however scroll magic is still not able to target it.
My best guess is that scrollmagic is loading before the plugin has inlined the svg, I have scrollmagic loading I the footer but is there another way to delay scrollmagic until the svg is inlined!