Jump to content
Search Community

Sandboxing Draggable

vamtam
Moderator Tag

Go to solution Solved by GreenSock,

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

Posted
Suppose that I have the following code:

 



window.mygs = window.GreenSockGlobals = {};
Modernizr.load( [ {    load: [
        'TweenLite.js',
        'ThrowPropsPlugin.js',
        'CSSPlugin.js',
        'Draggable.js',
    ],
    complete: function () {
        window.GreenSockGlobals = window._gsQueue = window._gsDefine = null; // from TweenLite.js line 67
        
        window.mygs.Draggable(...);
    }
} ] );

 


 

When I run it, I get this error:

 



Uncaught TypeError: Cannot read property 'greensock' of undefined Draggable.js:795


 

What am I doing wrong? Is it possible to load a sandboxed version of GSAP asynchronously? I only need it after the page has loaded, so I'd prefer to load it asynchronously.

 

Thank you.

Posted
Hi again,

 

I've done some additional tests and I have a basic demo of the problem here: http://vamtam.com/throwprops-test/ (check the console)

 

I now believe that there's something wrong with the sandboxing of Draggable. Right now I only have Draggable, ThrowPropsPlugin and TweenLite on the test page, Modernizr is not involved. The order of the scripts is the same as in this codepen -

See the Pen zDwEk by GreenSock (@GreenSock) on CodePen.

.

 

Is it not possible to sandbox Draggable similar to the method recommended here, for example: http://greensock.com/forums/topic/9881-avoid-multiple-loaded-tweenmax-and-tweenlite/?

Posted

Hi, 

 

Draggable requires TweenLite and CSSPlugin. 

It appears you are not loading CSSPlugin.

 

<script src="Draggable.js"></script>
<script src="ThrowPropsPlugin.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.14.2/TweenLite.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/1.14.2/plugins/CSSPlugin.min.js"></script>

Try that and let us know if that works

 
  • Solution
Posted

That was an issue with Draggable - sorry about that. It should be fixed in the upcoming release. I have attached a preview - please let me know if that works well for you. 

GSAP_1.14.3_preview4.zip

  • Like 1

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...