Jump to content
GreenSock

rotaercz

I can't seem to get a div moving.

Recommended Posts

Hi everyone!

 

This is my first post here. This is probably a very easy question but I can't seem to get a single div to do anything.

 

html

 

    <img data-name="test" src="test.jpg" width="200" height="283">

 

javascript:

 

    var mydiv = $('img').find('[data-name=test]');

    TweenMax.to(mydiv, 2, {css:{height:"400px", width:"283px"}, ease:Linear.easeNone});
 
I have the above code in an external javascript file. I'm trying to get an image to increase in width and height just for test purposes to get things rolling. I've declared jquery.min.js, TweenMax.min.js, jquery.gsap.min.js. Jquery works fine but I can't seem to get TweenMax to do anything. Can someone help me figure out how to get a helloworld going for GSAP? Any help would be greatly appreciated.
Link to comment
Share on other sites

I don't think your selector is good. Try with var mydiv = $('img'[data-name=test]');

  • Like 3
Link to comment
Share on other sites

Thank you! That worked! Though you do have to remove the quote right after img in your example.

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