Jump to content
Search Community

Hidden SVG elements can still trigger events problem

RoaldKamman test
Moderator Tag

Recommended Posts

Hey everyone, 

 

Thanks for taking your time to try and help out. 

 

This is my first time animating through JavasCript and GSAP so please bare with me. 

 

I'm currently running into an issue where I'm trying to create an animation on this SVG that has some hover and click event listeners/handlers. 

 

At some point the original elements that I bound to the handlers disappears intentionally. But the click and hover handlers are still on the same coordinates. And they keep triggering events. 

 

I tried: 

* 1 - I tried disabling the elements with things like: $buttonGroup.disabled = true;. I believe this worked with the click event but failed on the hover handler when I tried it. 

 

* 2 - building an if statement around the hover function that checks if the button has been clicked. let hoverActive = true;. gets set to hoverActive = false; when the button is clicked. 

 

The spiral and button elements shouldn't work after the button has been clicked once. And not reappear through hover or click actions. 

 

Any help would be highly appreciated :). 

See the Pen NWGaYmj by RoaldKamman (@RoaldKamman) on CodePen

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