M
M
mars1302021-11-11 18:36:31
JavaScript
mars130, 2021-11-11 18:36:31

How to open modal window in bootstrap 5 by url?

There is a page on Bootstrap 5.0.1 on it there is a modal window.

<div class="modal mbr-popup cid-sGH0cV2dmq fade" tabindex="-1" role="dialog" data-overlay-color="#000000" data-overlay-opacity="0.8" id="mbr-popup-2q" aria-hidden="true">
        <div class="modal-dialog modal-lg modal-dialog-centered" role="document">
            <div class="modal-content">
                <div class="modal-header pb-0">
                    <h5 class="modal-title mbr-fonts-style display-5">Название курса</h5>
                    <button type="button" class="close" data-dismiss="modal" data-bs-dismiss="modal" aria-label="Close">
                        <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" fill="currentColor">
                            <path d="M13.4 12l10.3 10.3-1.4 1.4L12 13.4 1.7 23.7.3 22.3 10.6 12 .3 1.7 1.7.3 12 10.6 22.3.3l1.4 1.4L13.4 12z"></path>
                        </svg>
                    </button>
                </div>

                <div class="modal-body">
                    <p class="mbr-text mbr-fonts-style display-7">
                        Описание курса</p>
                    <div>
                        </div>
                    </div>
                </div>
            </div>
        </div>


I want to display a description of the courses through PHP, I want to put a link on the description button ala cours.php?id=3#info tried through

$(document).ready(function() {
    if(window.location.href.indexOf('#info') != -1) {
      $('#mbr-popup-2q').modal('show');
    }
    });

But for some reason it doesn’t work, I read that Bootstrap 5 has other output methods, but I still don’t understand how to do it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
Johnny Gat, 2021-11-11
@mars130

https://getbootstrap.com/docs/5.0/components/modal...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question