Hello
I have updated an older project with GSAP 3.0.1 and ran into a strange behaviour. I had used Draggable & ThrowProps plugin before. The new code is just like this:
Draggable.create('#test', {type: 'x', inertia:true});
With the new scripts it suddenly threw an error:
“Uncaught TypeError: Cannot read property 'scrollWidth' of null at za (Draggable.min.js:1)…”
I reduced the project to the single line above for CodePen. It mysteriously worked on CodePen but not offline and not on my local server. This it gave my an idea: I checked the order of JS files and this is where it becomes really strange.
On CodePen the scripts are loaded in this order:
1 gsap.min.js
2 Draggable.min.js
3 InertiaPlugin.min.js
On CodePen it works.
The same order locally throws the error above.
The some order locally using type:'x,y' perfectly works!?
Actually the only loading order that works locally is:
1 Draggable.min.js
2 gsap.min.js
3 InertiaPlugin.min.js
I’m glad that I figured this out because I can continue working on my game but it took hours.
Is there an official loading order for the GSAP package or another explanation? Could you play around with a local version and check if you can reproduce the problem?
Greetings,
Henry
PS. GSAP 3 is great anyway.