S
S
Stanislav Pochepko2015-03-18 17:52:25
JavaScript
Stanislav Pochepko, 2015-03-18 17:52:25

Is it possible to open a bootstrap modal window depending on the anchor in the URL?

Faced with the need to open a modal window if the user clicked on the url .com/page#myNameModal
Is this possible using standard bootstrap tools? Maybe there is an attribute that is responsible for this? Or you need to write some js.
P.S. Give a link to an explanation of additional type attributes

data-dismiss="modal"
aria-labelledby="myModalLabel"
aria-hidden="true"

And then at the office. The site is somehow cleverly written and even in English. hard to figure out

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Goryachkin, 2015-03-18
@DJZT

Like this:

$(document).ready(function () {
    var hash = window.location.hash;
    if (hash === "#myNameModal") {
        $('#myModal').modal(options);
    }
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question