简体   繁体   中英

Bootstrap Modal open on new page

I have a bootstrap toggle link which will open a full screen modal windows on left click which will display all the information.

<a data-toggle="modal" data-backdrop="static" href='#modal-add-contact' class='btn'>View Info</a>

However, sometimes when user go through the table list on the page with multiple View Info links, they tend to right click and open to new tab , or right click and open to new window .

So it end up displaying the table list of info with the View Info link instead of the modal window.

How can I let the new tab window load the Modal on default base on the link clicked?

If user right clicks and opens link in tab, he will get same url with a hash tag www.example.com#modal-add-contact

So if you simply

$(document).ready(function() {
    $(window.location.hash).modal("show");
});

modal will be up.

Have you tried capturing right-clicks that an event fires up named oncontextmenu ? explained in this answer You just have to manually open the modal dialogue using code of some JQuery explained in this answer

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM