Jump to content


A problem mouseenter and mouseleave

Moderator Tag

Recommended Posts


Could you please help me with processing an animation when putting a pointer on and off the imgBoxOne block?

The problem is the next: mouseenter and mouseleave are conflicting when putting the pointer on and off the block too fast. 

Is that possible to make them wait for each other somehow?

Actually, these functions are conflicting with each other. (mouseenter =>animaBoxOneFirst ,  mouseleave => animaBoxOneReverse)


See the Pen by s (@s) on CodePen

Link to comment
Share on other sites

Hey Roman.


By default, GSAP does not kill off tweens that affect the same properties of the same objects. If you want that to happen, you should set overwrite: 'auto' (or true) for the tweens that conflict. Alternatively, change the property globally: gsap.defaults({overwrite: 'auto'});


However, in your case it might make more sense to setup a timeline for the hover transition when the JS is initialized. Then on mouseenter you play it, on mouse leave you reverse it.

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.