Jump to content
GreenSock

Conversant

Loaded Plugins

Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Is there a way to see what plugins are loaded? For example, I want to be able to detect if CustomEase or ScrollTo is available on a page.

Link to comment
Share on other sites

typeof ScrollToPlugin;

 

returns "function" if ScrollToPlugin is available.


 

if(typeof ScrollToPlugin === "function"){

	//use ScrollToPlugin

}

 

Same can be used for 'CustomEase'.

Link to comment
Share on other sites

Hi @Conversant :)

 

Welcome to the forum. 

 

This should work for you:

if (window.CustomEase && window.ScrollToPlugin) {}

 

Happy tweening.

:)

  • Like 1
Link to comment
Share on other sites

In case you need a whole list of them:

var plugins = com.greensock.plugins;
Object.getOwnPropertyNames(plugins).forEach(
  function (val, idx) {
    $("<li>" + val + "</li>").appendTo("ul");
  }
);
var eases = com.greensock.easing;
Object.getOwnPropertyNames(eases).forEach(
  function (val, idx) {
    $("<li>" + val + "</li>").appendTo("ul");
  }
);

 

See the Pen qXpEdR?editors=1010 by GreenSock (@GreenSock) on CodePen

 

  • Like 3
Link to comment
Share on other sites

Ha, don't worry. I kind of stole this from Jack recently. Overheard it while I was re-doing the bathroom tile ;)

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×