We have a modal with a text link (anchor) in the pop-up <a data-link-type="anchor" href="#aanmelden"> and the anchor works fine, but the modal must be closed with the same click on that link. Is there a way to do this in the source code in the article?
Unfortunately this does not work. I've tried different things, but it doesn't work. I have put in the exact code from your example... I get a popup with button, but the button does nothing.
{modal content="close-my-modal" closebutton="false" overlayclose="false" esckey="false"}Modal with a custom Close Button{/modal}
{modalcontent close-my-modal}
<p>You can only close this modal with this button:</p>
<p><a class="btn btn-danger" onclick="jQuery.rl_modals.close();">Close this Modal</a></p>
{/modalcontent}
Hope you have a solution for this...
Regards,
Michiel
It looks like you are using the Joomla 4 version of Modals, which is still in full development and not ready for (production) use yet.
It is fine to test it out. But things can and will still change before release.
Yes, that's right... too bad it doesn't work (yet). Do you have a good alternative that you can recommend? Of course temporarily, because the RegularLabs extensions remain our preference 😉
Ok... something is working now 😉
When I put this in: <a class="button" href="/service/trainingen" onclick="regularlabs.modals.close()">
The modal will close and the page refreshes... to another page also works fine.
BUT... I don't get it to link to an anchor yet. Tried these codes:
<a class="button" data-link-type="anchor" href="#aanmelden" onclick="regularlabs.modals.close()" target="_self">
<a class="button" data-link-type="anchor" href="/service/trainingen#aanmelden" onclick="regularlabs.modals.close()" target="_self">
<a class="button" data-link-type="anchor" href="
05.bluepoint-concept.nl/service/trainingen#aanmelden
" onclick="regularlabs.modals.close()" target="_self">
The anchor works...because it is scrolling down... but it won't close 😉
PS: When creating a link that opens a different page, you don't really need to have it also close the modal.
The loading of the new page will mean the modal is gone.