How to initiate the modal in v7

2 replies · opened Jul 1, 2023

PpadejarJul 1, 2023

Hello, i've tried to initiate the modal in v7 but seems like it doesn't work.

I've tried:


window.addEventListener('pluginBootstrapReady', () => {
        timeoutModal = new bootstrap.Modal("#modal-timeout", {
            backdrop: 'static',
            keyboard: false,
        });
        successModal = new bootstrap.Modal("#modal-success", {
            backdrop: 'static',
            keyboard: false,
        });
    });

I've debug it but it seems like the event 'pluginBootstrapReady' doesn't get triggered.

You can check the live url and see if I've missed something.

Use the following credentials to login first, and then go to the live url:
username: test@test.com
password: password

PpadejarJul 1, 2023

My bad, it seems like loading the functions.js instead of functions.bundle.js do the trick.

SSemicolon WebSTAFFJul 1, 2023

Hello,

Glad the issue was resolved.

When using js/functions.bundle.js File, there is no need to use Events as the Bootstrap JS Codes or other Plugins are already on the Page. So simply using this will be fine:
[ch_pre type"js"]timeoutModal = new bootstrap.Modal("#modal-timeout", {
backdrop: 'static',
keyboard: false,
});
successModal = new bootstrap.Modal("#modal-success", {
backdrop: 'static',
keyboard: false,
});[/ch_pre]

Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard