• <i id='MnqBN'><tr id='MnqBN'><dt id='MnqBN'><q id='MnqBN'><span id='MnqBN'><b id='MnqBN'><form id='MnqBN'><ins id='MnqBN'></ins><ul id='MnqBN'></ul><sub id='MnqBN'></sub></form><legend id='MnqBN'></legend><bdo id='MnqBN'><pre id='MnqBN'><center id='MnqBN'></center></pre></bdo></b><th id='MnqBN'></th></span></q></dt></tr></i><div id='MnqBN'><tfoot id='MnqBN'></tfoot><dl id='MnqBN'><fieldset id='MnqBN'></fieldset></dl></div>

      <bdo id='MnqBN'></bdo><ul id='MnqBN'></ul>
    <legend id='MnqBN'><style id='MnqBN'><dir id='MnqBN'><q id='MnqBN'></q></dir></style></legend>

    1. <tfoot id='MnqBN'></tfoot>

        <small id='MnqBN'></small><noframes id='MnqBN'>

        在引导程序中动态调整模态对话框的大小

        时间:2023-06-21
            <tbody id='E1xkr'></tbody>
          • <small id='E1xkr'></small><noframes id='E1xkr'>

            • <bdo id='E1xkr'></bdo><ul id='E1xkr'></ul>

              <tfoot id='E1xkr'></tfoot>

                <legend id='E1xkr'><style id='E1xkr'><dir id='E1xkr'><q id='E1xkr'></q></dir></style></legend>
                  <i id='E1xkr'><tr id='E1xkr'><dt id='E1xkr'><q id='E1xkr'><span id='E1xkr'><b id='E1xkr'><form id='E1xkr'><ins id='E1xkr'></ins><ul id='E1xkr'></ul><sub id='E1xkr'></sub></form><legend id='E1xkr'></legend><bdo id='E1xkr'><pre id='E1xkr'><center id='E1xkr'></center></pre></bdo></b><th id='E1xkr'></th></span></q></dt></tr></i><div id='E1xkr'><tfoot id='E1xkr'></tfoot><dl id='E1xkr'><fieldset id='E1xkr'></fieldset></dl></div>
                  本文介绍了在引导程序中动态调整模态对话框的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个 Modal Popup (Bootstrap),它根据用户选择显示内容

                  • )

                    为了让它更动态,你需要计算表格的宽度(jQuery width()innerwidth())并设置 modal-dialog根据它.

                    参见:http://bootply.com/88364

                    I have a Modal Popup (Bootstrap) which displays content based on the user selection

                    • I've used this as my reference, Also added this to my script section in the aspx page

                    This is the javascript code that i've used to check for the users selection

                    PlayerMP.getFunctionalDetails = function (type, UserID, SessionID, SessionNo) {
                    $.ajax({
                        type: "GET",
                        url: PlayerMP.URL,
                        data: "rt=4&type=" + type + "&UserID=" + UserID + "&SessionID=" + SessionID + "&SessionNo=" + SessionNo,
                        success: function (FunctionalSplitsJS) {
                            if (FunctionalSplitsJS.indexOf("SessionExpired=1", 0) == -1) {
                    
                                $("#divFunctionalDetails").html(FunctionalSplitsJS);
                                switch (type) {
                                    case 1:
                                        $("#divFunctionalsSplit");      //the table goes out of the modal window                           
                                         break;
                                    case 2:
                                        TallyFunctionalSheet();
                                        $("#divFunctionalsSplit"); 
                                        break;
                                    case 3:
                                        $("#divFunctionalsSplit"); 
                                        break;
                                }                
                    
                                 $("#divFunctionalsSplit").modal('show');
                            }
                            else
                                window.location.href = "../Login.aspx?SessionExpired=1";
                        }
                    });
                    }
                    

                    • The first case has a table which is supposed to be displayed inside the modal popup but the table goes outside the modal window (there is a problem with the width of the modal window but the table-responsive seem to be working) But when i resize the browser to match the width of the tablet the table/modal auto resizes to match each other.
                    • The width of the 2nd and the 3rd case's of the modal seem to work fine.

                    This is the code for the modal window thats being called

                     <div class="modal fade" id="divFunctionalsSplit" tabindex="-1" role="dialog" aria-hidden="true">  
                            <div class="modal-dialog">
                                <div class="modal-content"> 
                                      <div class="modal-body">
                                        <div class="table-responsive">
                                            <div id="divFunctionalDetails"></div>
                                          </div>
                                       </div>
                                       <div class="modal-footer">
                                       <button type="button" class="btn btn-primary" data-dismiss="modal">Done</button>
                                       </div>
                                </div>
                            </div>
                     </div>
                    

                    • Fullscreen Browser
                    • Resized Browser

                    解决方案

                    By default Bootstrap sets the width of the .modal-dialog to 600px (large screens above 768 px) or auto(small screens). The code below overrides this:

                    $('#myModal').on('show.bs.modal', function () {
                        $(this).find('.modal-dialog').css({width:'auto',
                                                   height:'auto', 
                                                  'max-height':'100%'});
                    });
                    

                    (based on: https://stackoverflow.com/a/16152629/2260496)

                    To make it more dynamically you will need to calculate the width (jQuery width() or innerwidth())of your table and set the width of the modal-dialog according it.

                    See: http://bootply.com/88364

                    这篇关于在引导程序中动态调整模态对话框的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何在打开时仅在模式弹出窗口内限制 Tab 键按下? 下一篇:Bootstrap 3/显示模式不适用于javascript方式

                  相关文章

                  <i id='OZN2e'><tr id='OZN2e'><dt id='OZN2e'><q id='OZN2e'><span id='OZN2e'><b id='OZN2e'><form id='OZN2e'><ins id='OZN2e'></ins><ul id='OZN2e'></ul><sub id='OZN2e'></sub></form><legend id='OZN2e'></legend><bdo id='OZN2e'><pre id='OZN2e'><center id='OZN2e'></center></pre></bdo></b><th id='OZN2e'></th></span></q></dt></tr></i><div id='OZN2e'><tfoot id='OZN2e'></tfoot><dl id='OZN2e'><fieldset id='OZN2e'></fieldset></dl></div>

                1. <tfoot id='OZN2e'></tfoot>
                2. <small id='OZN2e'></small><noframes id='OZN2e'>

                      <bdo id='OZN2e'></bdo><ul id='OZN2e'></ul>
                    1. <legend id='OZN2e'><style id='OZN2e'><dir id='OZN2e'><q id='OZN2e'></q></dir></style></legend>