Jump to content
Search Community

Cant get TweenMax to work

cwredcross 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

Here's my sample code.  Pretty simple.  Yet it doesn't work on my server.  I don't see a coding problem. Do I need to change a server setting?  Url is www.leadsgopro.com. Please help.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
 
<style>
body{
  background-color: black;
}
html, body, #container {
width:100%; 
height:100%;
}
</style>
 
<script>
TweenMax.to(".logo", 2, {left:600});
</script>
 
</head>
<body> 
 
<div id="container">
<img id="logo" class="logo" src="http://gravatar.com/avatar/5a224f121f96bd037bf6c1c1e2b686fb?s=512" height="150" width="150">
</div>
</body>
</html>
Link to comment
Share on other sites

Hi cwredcross, welcome to the forums!

 

The way you have it, you are telling JavaScript to access an element that does not exists yet. You either use a window.onload event or you have you JavaScript at the bottom of your page.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR...D/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 

<style>
body{
  background-color: black;
}
html, body, #container {
width:100%; 
height:100%;
}
</style>

<script src="http://cdnjs.cloudfl...n.js"></script>

</head>
<body> 

<div id="container">
<img id="logo" class="logo" src="http://gravatar.com/...1e2b686fb?s=512" height="150" width="150">
</div>

<script>
TweenMax.to(".logo", 2, {left:600});
</script>

</body>
</html>
  • Like 3
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...