Opening Modal on Site Load

Hello, this is a continuation of a previous question I had.

I am trying to have a modal display as open if the user has not been to the site before.

I have built the modal as a component and have added it to the header of the page.

In the custom JS for the header I have added some code to trigger a click event on the modal toggle listening for DOMContentLoaded, however it doesn’t seem to trigger the toggle. I’ve put in a few console.log statements in the function and it SEEMS to be working its way through correctly, but the modal isn’t opening? I’m wondering is there some other event I need to listen to or something like that, perhaps cornerstone loads in certain components later or something?

I would appreciate if someone could have a quick look for me at this, it has to be something simple I am doing wrong. :confused:

The component is called Localisation Modal in Cornerstone and the JS to trigger it is in the header in Cornerstone. I would really appreciate any input on this as I’ve been banging my head against the wall here for the last day with this.

I am attaching admin credentials in the secure note below. Thanks in advance!

Hey Stephen,

Thanks for writing in!

Please add an ID to your Modal element.

You can then use my-modal-anchor-toggle as the ID of the Modal Toggle button.

Be advised that custom coding is beyond the scope of our support under our Support Policy. If you are unfamiliar with code and resolving potential conflicts, you may select our One service for further assistance.

Best Regards.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.