Jump to content
Search Community

TweenMax is not working on public website

callavar 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

So I just got a little hover animation finished using TweenMax.to() and .from(), and I had it working perfectly(almost) within both codepen and jsfiddle. Then, when I transferred everything over to my website, something clearly went wrong, because the hover animations are no longer firing.

 

The website is www.outbackbay.com if you'd like to see what I'm talking about. Checking the sources, I can tell that everything should be loading in right, I even added some console.logs and you can see that some, but not all are firing. They are being loaded in the right order, with the custom.js being loaded in last. The only thing that I can maybe think of is that jQuery versions may be different? I don't know how large of an effect that would cause, however. Please take the time to look over it and give me some sort of direction. Thank you.

 

And by the way, I know the codepen looks like trash, I didn't want to take the time to get everything aligned. You can see how the hover animations are supposed to look, however.

See the Pen vRrZer by callavar (@callavar) on CodePen

Link to comment
Share on other sites

Try moving your "$('.planet').hover ..." to be within $(document).ready(). I dont' think they are ready when the script tries to bind the hover event handler to them.

 

$(document).ready(function() {
  
	TweenMax.to(".planet-name", 0, {
  		xPercent: '-50'
	});
  
    // ----- PLANET HOVER ------ //
    $(".planet").hover(function() {
      console.log("help me");
      TweenMax.to($(this), 0.5, {
        scale: 1.8
      })
      TweenMax.from($(this).siblings(), 0.5, {
        bottom: "-40%"
      })
      TweenMax.to($(this).siblings(), 0.5, {
        opacity: 1,
      })
    }, function() {
      TweenMax.to($(this), 0.5, {
        scale: 1
      })
      TweenMax.to($(this).siblings(), 0.3, {
        opacity: 0,
        bottom: "-20%"
      })
    });

});

 

  • Like 6
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...