oxyShowModal() #217
bardolf69
started this conversation in
Coding (HTML, PHP, CSS, JS)
Replies: 1 comment
-
Hi @bardolf69 If the Modal is a child of the clicked element, you can use this solution: https://gist.github.com/Spellhammer/5ee15003eaccb96998a8eb2795d0c814. Please note the parent element of the modal needs the class "open" with this code. You can change that as you wish. Otherwise, if the modal is not a child element, you'd need to modify the code to something such as: document.querySelectorAll('.open').forEach( trigger => {
trigger.addEventListener('click', (e) => {
e.preventDefault();
modalParent = document.querySelector('#id_of_modals_parent_element');
theModal = modalParent.querySelector('.oxy-modal-backdrop');
oxyShowModal(theModal);
})
}) Please note that in this example, the Modal still needs to be the child of another element. I hope this helps! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to display different modals conditionally from javascript but I can't work out what id I should be supplying to the oxyShowModal function.
None of these work.
Beta Was this translation helpful? Give feedback.
All reactions