Forum Discussion

MichaelCarlino-'s avatar
MichaelCarlino-
Community Member
2 months ago

GSAP Draggable

Hello all,

 

I cannot remember if GSAPS Draggable is already part of the GSAP library that is already in storyline or if it has to be added manually.  If it has to be added manually can you also point me in the right direction on how to add it manually?

  • Storyline just includes basic GSAP. You can add plugins in different ways. Draggable seems to be quite small, so there is not a lot of overhead attached to loading it. A simple approach is to include the following script, triggered to run on timeline start.

    var script = document.createElement('script');
    
    script.src = "https://cdn.jsdelivr.net/npm/gsap@3.12.5/dist/Draggable.min.js";
    
    script.onload = function() {
    	//Plugin now loaded. Do something here if you need to.
    	console.log("GSAP Draggable loaded");
    }
    
    document.head.appendChild(script);

    You could put this on whatever slide you need to use it on, or on the master if you need it on all slides.

    An alternative approach, and one that is better if the library is large or if you wish to include static code with your published module, is to load the plugin script only once from an included web object. To do that, see the following article for the code and procedure. It is pretty straighforward.

    How to add jQuery or anyother external Javascript Library to Storyline | Articulate - Community502 Proxy Error

    • MichaelCarlino-'s avatar
      MichaelCarlino-
      Community Member

      Thanks, Nathan 

      I  remembered Math had a post I had trouble finding so thank you for the link.