robinparisi / tingle

⚡ 2kB vanilla modal plugin, no dependencies and easy-to-use
https://tingle.robinparisi.com
MIT License
1.56k stars 184 forks source link

How to set static modal in html? #147

Closed aalfiann closed 3 years ago

aalfiann commented 3 years ago

Because I'm using react, so I need to render the UI first in html.

With using this library, how to just open the modal and without setContent?

robinparisi commented 3 years ago

Hi,

You can write a custom wrapper for react (I'm not familiar with this framework) or pass content in a more classical way, there is a lot of possibilities, but for now, there is no easy way since a React plugin would be required.

aalfiann commented 3 years ago

Hey, after write this issue, suddenly I found the trick.

After react succesfull in render, then I just call the modal like this

beforeOpen: function() {
  modal.setContent(document.getElementById('detail').innerHTML);
},

Thank you.