Forum Discussion
Fix for loss of jQuery and GSAP in new update
Hey all,
If you used to use jQuery and GSAP, it has been removed in the latest update. I've found a work around for anyone that wants to keep using it.
Simply add this code into your slide when timeline starts:
function dynamicallyLoadScript(url) {
var script = document.createElement("script");
script.src = url;
document.head.appendChild(script);
}
dynamicallyLoadScript("https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js");
dynamicallyLoadScript("https://cdnjs.cloudflare.com/ajax/libs/gsap/3.1.1/gsap.min.js");
To target elements on the page which you used to do with:
var obj = $('[aria-label= "obj"] svg');
You now can use:
var obj = $('[data-acc-text = "obj"] svg');
Cheers,
Andrew
- MathNotermans-9Community Member
As the question how to add jQuery pops up now and then i made a post explaining it, and a sample added to it...
https://community.articulate.com/discussions/articulate-storyline/how-to-add-jquery-or-anyother-external-javascript-library-to-storyline - CurtisWiens-ce1Community Member
Thanks! There is also an issue with tweening SL objects using GSAP, specifically to an X value. I have the fix for that. Got it from a Articulate Engineer.
- WaltHamiltonSuper Hero
Curtis,
Can you share that?
- NataschaMatt256Community Member
Thanks a lot for sharing this, it's a big help!
- AndZandCommunity Member
Hello, thank you for sharing. I'm trying to use the updated method but keep getting an error. Storyline v.3.39.21985.0
actionator::exeJavaScript - $ is not defined
Here is the code I used:
function dynamicallyLoadScript(url) {
var script = document.createElement("script");
script.src = url;
document.head.appendChild(script);
}dynamicallyLoadScript("https://cdnjs.cloudflare.com/ajax/libs/gsap/3.2.6/gsap.min.js");
var square = $('[data-acc-text = "square"] svg');
TweenLite.to(square, 1, {rotation: 360});
- PhilMayorSuper Hero
You need to load jquery as well and ensure that the librrays are loaded before firing your javascript, do not put them in the same triigger or add code to ensure the libarary is loaded.
- AndZandCommunity Member
Phil, you are genius. It works.
- AndZandCommunity Member
Just one more question more specifically about using functions with GSAP. I'm trying to create a timeline to sequence multiple animations, but it doesn't seem to work properly. Here is the code:
var tl = gsap.timeline();
tl.from(obj1, 1 {y: 100, stagger: 0.2});
tl.from(obj2, 1 {y: 100, stagger: 0.2});
tl.from(obj3, 1 {y: 100, stagger: 0.2});
Error:
Uncaught SyntaxError: missing ) after argument list
It seems like it cannot use the function properly. Has anyone found a solution?
- PaulWestlake-a8Community Member
Hi - It is possible to use this method to share a Storyline 360 course via Review 360 to embed into a RISE course?
- Jonathan_HillSuper Hero
Only just found this post and wanted to say THANK YOU VERY MUCH! No more 'hacking' the published file to re-insert jQuery 👍🏻
- AndZandCommunity Member
Hello,
has anyone noticed that since one of the last updates of the SL, the objects moved with JS would leave vertical lines behind. Look at the picture: the red ball, which is a circle that I drew in SL, is being moved from right to left with GSAP and there are narrow lines behind.
Any idea how to prevent them from appearing?