ghosh / Micromodal

⭕ Tiny javascript library for creating accessible modal dialogs
https://micromodal.now.sh/
MIT License
3.54k stars 230 forks source link

Not working without css animations #59

Closed evanre closed 6 years ago

evanre commented 6 years ago

Hi, I can't make it work properly. It didn't close without css animations ("is-open" class is not removing).

I need just instantly show\hide a small window on my project (without animations and full page overlays).

Here is example on CodePen.

kalpeshsingh commented 6 years ago

You missed the animation part and some HTML tags in your example. Here is update version which work as expected.

ghosh commented 6 years ago

@evanre Thanks for reporting this. It seems it not possible at the moment to dismiss the modal without any animation. Will look into it.

@kalpeshsingh The need is to toggle the modal without any animation and overlay.

https://github.com/ghosh/micromodal/blob/ee29c996fc42477f02588a618395bcac05ed285c/src/index.js#L59-L62

Here we listen for an animationEnd event and then toggle the visibility of the modal. As @evanre pointed out this should work without any animation also.

evanre commented 6 years ago

@ghosh Hi, thank you for the answer. The problem is that I've wasted a lot of time to find it out, because main tutorial on the website says nothing about the animation requirements.

ghosh commented 6 years ago

@evanre Yup, this was an oversight on our part. It definitely needs to be fixed. Thanks again for reporting this.

kalpeshsingh commented 6 years ago

My bad. I misunderstood your question @evanre. We will fix it and inform you.