halfmoonui / halfmoon

Halfmoon is a highly customizable, drop-in Bootstrap replacement. It comes with three built-in core themes, with dark mode support for all themes and components.
https://www.gethalfmoon.com
MIT License
3.03k stars 118 forks source link

Close modal with js opened without it #66

Closed MeowningMaster closed 3 years ago

MeowningMaster commented 3 years ago

Sorry for my english

There is modal with id="modal-1" and button with href="#modal-1". So if you open modal with button you can't close it with halfmoon.toggleModal('modal-1')

halfmoonui commented 3 years ago

You are misunderstanding how the modals work without JavaScript. The button with the href="#modal-1" opens the modal using the CSS :target attribute. In order to close this modal, your close button needs to change the anchor in the URL, so something like this: <a href="#>Close modal</a>. A modal opened using JavaScript can be closed with JavaScript. I would recommend reading this part of the docs: https://www.gethalfmoon.com/docs/modal/#javascript-usage

I will go ahead and close this. Please re-open it if you think the issue is not resolved.

MeowningMaster commented 3 years ago

ok, thanks