Jump to content
Search Community

Draggable: Error on load

Dum test
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

On all browsers I'm getting a 
 
Uncaught TypeError: Cannot read property 'style' of null
 
This is the culprit: 
 
v = function(t, e) {
var s, r, n, a = t.style;
 
Uncaught TypeError: Cannot read property 'style' of null
if (void 0 === a[e]) {
for (n = ["O", "Moz", "ms", "Ms", "Webkit"], r = 5, s = e.charAt(0).toUpperCase() + e.substr(1); --r > -1 && void 0 === a[n[r] + s]; )
;
if (0 > r)
return "";
i = 3 === r ? "ms" : n[r], e = i + s
}
return e
}
 
 
It's all obfuscated so I'm not too sure what's going on here. Why that function is even running on load when no animations have run is beyond me.
 
Still happens on an isolated page with this stack: 
   
<script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/latest/TweenMax.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/latest/plugins/ColorPropsPlugin.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/latest/plugins/TextPlugin.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/latest/plugins/ScrollToPlugin.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/latest/utils/Draggable.min.js"></script>
 
 
This may be an artifact of obfuscation? Was still happening on other versions of 1.10.x
Link to comment
Share on other sites

I think I know what it is - you put your <script> tag in the header (before the body), right? So technically the body doesn't exist yet. Try putting your script tag in or below the body. We're about to release a new version of Draggable that should fix that. But in the mean time, you can just move your <script> tag. 

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