Jump to content
Search Community

Hover effect button mouseenter mouseleave

timdt 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 guys, so i stole this button from one of your tutorials.

It works on the one i reacreated but...

 

I am making a banner for adwords. This means i cannot use jquery.
This is where i am stuck.
How do i get the glowing effect to work on my button just with javascript and TweenMax?

 

Thanks guys much love <3

See the Pen ZXPXyx by timdt (@timdt) on CodePen

Link to comment
Share on other sites

A couple quick things ... you have a lot of variable names/selectors going on ...

 

learnmore

$learnMore

'#learnMore'

 

First and foremost, your first line needs to be capital `M` in the id `learnMore` because that is how the ID is assigned in the html, and you don't use the # when get an element by id.

 

var learnmore = document.getElementById("learnMore")

 

Then ... use your variable 'learnmore' ... not other misspellings; e.g. $learnMore. Technically you can use the '#learnMore' selector as GSAP has a built selector engine. But, for consistency, I would use the variable that is already created.

 

Lastly, use event listeners to call the functions wrapping each Tween

 

See the Pen BwbwqW by sgorneau (@sgorneau) on CodePen

 

 

  • Like 7
Link to comment
Share on other sites

@Shaun Gorneau

 

Yeah sorry about the variable names :( I was in a hurry so didnt pay much attention to that.

Oke, didnt know that about the eventlisteners. will look that up also today because i've never heard of that before.

Thank you for taking the time to fix the issue for me.
It is much appreciated.
 

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