简体   繁体   中英

How Can I change bootstrap-modal width in my situation?

I use the below way to load modal content to main html:

main html:

<div class="modal modal-custom fade" id="custom-view">
</div>
.....

modal html(on a Individual html):

<div class="modal-dialog">
    <div class="modal-content message_align">
        <div class="modal-body" align="center">
            <span class="section">Custom Info</span>
                {% crispy form form.helper%}
        </div>
    </div>
</div>

I load the modal content to main html like this:

$(".mod-custom").click(function(ev) {
    ......
    $("#custom-view").load(url, function() {
        $("#custom-view").modal('show');
    }
}

the url is to render data on modal html

In my situation,How to change the width?

I hope this link might help. Changing modal size. https://coolestguidesontheplanet.com/bootstrap/modal.php#myModal2

If you want to change the modal-content width, you can add modal-content width when #custom-view on click

$(".mod-custom").click(function(ev) {
......
$("#custom-view").load(url, function() {
    $("#custom-view").modal('show');
$('.modal-content').css({'width':'900px'});
}}

just change the class .modal-content if you want to change another class

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