不显示引导程序模式对话框(显示黑色背景)

问题描述 投票:0回答:1

我在HTML文件中有两个模式对话框(引起问题)。

哪个模式对话框位于html文件的序列的第一位,单击按钮时正确显示(反之亦然。)>] >>

两个模态对话框都有唯一的ID,并且会被适当地调用,但是一个模态对话框不会出现(如果稍后单独调用)。>>

     <!-- Modal dialog xyz is the first in the sequence of html code -->
     <div class="modal fade" id="xyzModal" tabindex="-1" role="dialog" aria-labelledby="xyzModalTitle" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered" role="document">
          .....
        </div>
     </div>

     <!-- Modal dialog abc is the second M.D in the sequence of html code -->
     <div class="modal fade" id="abcModal" tabindex="-1" role="dialog" aria-labelledby="abcModalTitle" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered" role="document">
          .....
        </div>
     </div>

在调用模态对话框时我到底在哪里出错。

对于相应的按钮单击,我也正在使用隐藏/显示功能,但是不起作用。

     $("#xyzModal").modal('hide');
     $("#abcModal").modal('show');

我在html文件中有两个模式对话框(导致问题)。在html文件的顺序中,哪个模式对话框位于第一个位置,单击按钮时正确显示(反之亦然)。都是模态...

如果您需要在打开新模态之前隐藏所有模态,那么最好的方法是:

$(".modal").modal('hide');
$("#abcModal").modal('show');

这可以确保在打开新的模态之前,先隐藏all

模态。
jquery html bootstrap-4 bootstrap-modal
1个回答
0
投票

如果您需要在打开新模态之前隐藏所有模态,那么最好的方法是:

© www.soinside.com 2019 - 2024. All rights reserved.