Jump to content
Search Community

how to tell version gsap

jimeast test
Moderator Tag

Go to solution Solved by PointC,

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

 

And by the way, you can type this into the console to find out on any live page: 

TweenLite.version

I didn't know that. That's quite handy. :)

 

Several months ago (at Blake's recommendation) I installed Chrysto's GSAP sniffer. That's been a nice little extension too.  For anyone not familiar with it - it's a Chrome extension that lights up green with the GS version number when you're on a site using GSAP.  More often than not when I see something awesome, that little icon is glowing green so GS is being used quite a lot out there.

 

If anyone wants to install the extension, here's the link:

https://chrome.google.com/webstore/detail/gsap-sniffer/ohjmhldioopcachmenfnhlbgmkaohgbb

  • Like 2
Link to comment
Share on other sites

TweenLite is global, so this is the same thing...

window.TweenLite.version

That's all the GSAP sniffer is checking. It appends the following code to the body, which triggers a custom event.

(function () {

    'use strict';
    
    var haveGSAP = false,
        GSAPVersion = null;

    if (typeof window.TweenLite == 'function') {
        haveGSAP = true;
        GSAPVersion = String(window.TweenLite.version);
    }

    var eventDetail = {
        "haveGSAP": haveGSAP,
        "GSAPVersion": GSAPVersion
    };

    var gsapEvent = new CustomEvent('gsapcheck', {
        'detail': eventDetail
    });
    document.dispatchEvent(gsapEvent);

})();

The reason the sniffer doesn't work on CodePen is because it's only checking the window for TweenLite. On CodePen, everything is loaded in an iframe so GSAP wouldn't be on the window. The only exception to this would be opening up a CodePen in debug mode.

  • Like 3
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.
×
×
  • Create New...