Jump to content
GreenSock

jimeast

Need simplest possible example of drag.

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

Since my example code is so simple I thought it might be best to just lay it out here rather than use codepen.

When I run the following code in firefox I get no error message but it doesn't drag either, in Chrome I get 2 errors:

Uncaught SyntaxError: Unexpected token <
dragTest.html:20 Uncaught ReferenceError: Draggable is not defined(anonymous function) @ dragTest.html:20
 
Here is my code:
 
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>drag test</title>
<style type="text/css">
#smallBox {
position: absolute;
width: 100px;
height: 100px;
background-color: red;
}
</style>
</head>
<body>
<div id="smallBox"></div>
<script src="gs/min/utils/"></script>
<script>
Draggable.create("#smallBox");
</script>
</body>
</html> 
Link to comment
Share on other sites

That sure sounds like Draggable isn't loaded.

//you have this
<script src="gs/min/utils/"></script>
// have you tried this ?
<script src="gs/min/utils/Draggable.min.js"></script>

Does that help?

:)

Link to comment
Share on other sites

I've tried that and when I do I get only 1 message   Uncaught ReferenceError: Draggable is not defined

Link to comment
Share on other sites

  • Solution

hmmm... I suppose we shouldn't overlook the obvious here - I don't see TweenMax being loaded in the code you posted.

 

If you load Draggable without TweenMax, you will still get the draggable is not defined error.

 

Could TweenMax be missing?

:)

 

Edit: you can also use TweenLite, but will need the CSSPlugin too. 

  • Like 2
Link to comment
Share on other sites

That did it! Thank you so much!

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