Jump to content
Search Community

gsap Modal missing a click on the outside box

DD77 test
Moderator Tag

Recommended Posts

Hey DD77. You've got a couple of warning about elements not existing. You should fix those.

 

Besides that, this is a logical issue. You should play your animation when the open button is clicked and reverse it when anything outside of the modal or the close button is clicked. 

 

If you have a specific question about GSAP let us know and we'll do our best to help.

  • Like 1
Link to comment
Share on other sites

Thank you Mikel, as usual you turned a some code into a piss of cake...
On my demo, I have multiple buttons, where I can open the modal. Then once opened a simple closing button, with a click outside the modal that could close it too.
On your demo I think you misinterpreted my initial question. 

Link to comment
Share on other sites

@DD77 Your demo has errors in the console when you click the button. Fix those. There's likely no reason why you would need .getBoundingClientRect, you can just animate the element using the x, y, xPercent, yPercent, scale, and autoAlpha properties. 

 

Again, most of your issues are logical. Sorry, but we don't have the capacity to build your project for you for free.

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