Jump to content
Search Community

GSAP with mouseover JQuery

lucrampro 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

Hey, everybody!
I have a problem I try to make a round grow if a mouse passes over but the animation is done directly I don't understand, doesn't GSAP work with Jquery?

 

if ($(".scale").mouseover) {

    TweenMax.to(".scale", 1, {
        css: {
            scale: 2,
            backgroundColor: "#343434"
        }

    });

} else {

    TweenMax.to(".scale", 1, {
        css: {
            scale: 1
        }
    });

}

please help me :)

Link to comment
Share on other sites

Hi @lucrampro,

 

GSAP certainly works well with jQuery ... but it looks like you're using jQuery incorrectly (if I understand what you want to accomplish). It looks like you want to respond to mouseenter and mouseleave ... simply a hover event.

 

$(".scale").hover(
  
  function(){
    TweenMax.to( $(this), 1, {
        css: {
            scale: 2,
            backgroundColor: "#343434"
        }

    });
  },
  
  function(){
    TweenMax.to( $(this), 1, {
        css: {
            scale: 1
        }

    });
  }
 
 );

 

EDIT: Sorry @OSUblake, didn't see that we were responding at the same time :)

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