Share Posted November 8, 2014 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. Link to comment Share on other sites More sharing options...
Author Share Posted November 14, 2014 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/? Link to comment Share on other sites More sharing options...
Share Posted November 15, 2014 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 Link to comment Share on other sites More sharing options...
Author Share Posted November 15, 2014 Sorry, it doesn't work with CSSPlugin either - http://vamtam.com/throwprops-test/ I've even tried using TweenMax, but this also didn't help. Link to comment Share on other sites More sharing options...
Share Posted November 16, 2014 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 1 Link to comment Share on other sites More sharing options...
Author Share Posted November 16, 2014 Thanks Jack, it works now. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now