Forum Discussion
No more jQuery?
Try this:
Put this on the Master Layout when the timeline starts. If you're using multiple layouts, put it on each.
var p = GetPlayer();
//var webLoc = p.GetVar("WebObjectFolder");
//this.oLocation="story_content/WebObjects/"+webLoc+"/";
function add_script(scriptURL,oID) {
var scriptEl = document.createElement("script");
var head=document.getElementsByTagName('head')[0];
var fn = "loadedCallback_"+oID
scriptEl.type = "text/javascript";
scriptEl.src = scriptURL;
scriptEl.id=oID;
scriptEl.onload = eval(fn);
head.appendChild(scriptEl);
}
if(document.getElementById('zsoltsupport')==null){
add_script("https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js","zsoltsupport");
}
function loadedCallback_zsoltsupport()
{
console.log("loaded")
}
This will load jQuery when Storyline starts or resumes. However, unfortunately, it takes time to load. If in the mean time your slide is trying to use jQuery it might not work. Therefore, on the slide when you usually just throw in jQuery when it starts, you have to wait until it is loaded:
For example, if on a slide I want to run something:
checkjQ();
function checkjQ()
{
if(!window.jQuery)
{
setTimeout(function(){checkjQ()}, 100);
}
else
{
//this is where you put your code with jQuery
}
}