Open Modal with link

Hi…

has anyone an Idea how to do this ? I want to open a Modal with an link ( for example in Volt CMS ) So the client can set the link.
thanks for the help

Hi @tom2,

You can open a modal using a link/href with the ID, eg. #my-modal

But you have to also have with it an attribute, eg data-bs-toggle=“modal”

Which I don’t think you can add with Volt at the moment. Although if your client is unlikely to ever add a link to another ID of the page, you could create some JavaScript to look for href’s that start with # within volt content and add the attribute.

A gave this a quick try and it seems to work.

2022-11-17_21-01-50

2 Likes

I’m meaning the attribute.

You’re not able to add a modal with Volt, but with Blocs itself :smile:

1 Like

Yes, as I understand the question he wants to trigger a modal.

Although, apparently we can edit the markup in Volt, so add the attribute??

But then that comes down to what the client is comfortable with I guess.

Hi @PeteSharp @Jerry

that’s correct - I want to trigger a modal

tom

So it’s not possible to add a modal inside Blocs with that attribute, even not on the attribute settings?

The attribute goes on the trigger. What ever element you are using to toggle the Modal.

1 Like

You never cease to amaze me. I really have a desire to learn these thing. If you were to suggest a place began, where would it be?