English 中文(简体)
诱杀5种模式的失败
原标题:Bootstrap 5 modal won t dismiss

我的所有模式都做了罚款。 但是,我在这里从诱杀4号诱杀装置运到诱杀5号装置,并赢得近关。 邻近的塔顿(人口最多的X)在路上走近。 而Cancelutton则打破了这一模式。

缩略语 我不知道我有多少人失踪。 不存在 Java字错误。

$( #open-modal ).on( click , function() {
  var $modal = $( #date-filter-modal );
  $modal.show();
});
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">

<button id="open-modal" type="button" class="btn btn-primary">Open Modal</button>

<div id="date-filter-modal" class="modal" tabindex="-1" role="dialog">
  <form method="get">
    <input type="hidden" name="ftype" />
    <input type="hidden" name="fid" />
    <div class="modal-dialog" role="document">
      <div class="modal-content">
        <div class="modal-header">
          <h5 class="modal-title"></h5>
          <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
        </div>
        <div class="modal-body">
          <div class="row">
            <div class="col-md-6">
              <div class="form-group">
                <label class="control-label">Start Date</label>
                <input class="form-control start-date" type="date" />
              </div>
            </div>
            <div class="col-md-6">
              <div class="form-group">
                <label class="control-label">End Date</label>
                <input class="form-control end-date" type="date" />
              </div>
            </div>
          </div>
        </div>
        <div class="modal-footer d-flex justify-content-between">
          <div>
            <button type="button" class="clear-date-filter btn btn-danger">Clear</button>
          </div>
          <div>
            <button type="submit" class="btn btn-success">Set Filter</button>
            <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
          </div>
        </div>
      </div>
    </div>
  </form>
</div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>

谁能提出我可能已经错过的东西?

问题回答

它像你一样,并不采用这种模式。 Remove display:/2005/4 from the Format and "show” it appropriate as:

let modal = new bootstrap.Modal( #date-filter-modal )
modal.show()
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>

<div id="date-filter-modal" class="modal" tabindex="-1" role="dialog">
    <form method="get">
        <input type="hidden" name="ftype" value="ShipDate">
        <input type="hidden" name="fid">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">Ship Date Filter</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="control-label">Start Date</label>
                                <input class="form-control start-date" type="date">
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="control-label">End Date</label>
                                <input class="form-control end-date" type="date">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer d-flex justify-content-between">
                    <div>
                        <button type="button" class="clear-date-filter btn btn-danger">Clear</button>
                    </div>
                    <div>
                        <button type="submit" class="btn btn-success">Set Filter</button>
                        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>

http://www.ohchr.org。

<button type="button" id="btnCloseCategories" class="btn btn-danger" data-dismiss="modal">Close</button>

http://www.ohchr.org。

<button type="button" id="btnCloseCategories" class="btn btn-danger" data-bs-dismiss="modal">Close</button>

Old: data-dismiss="modal"

New: data-bs-dismiss="modal"

象我这样看待这个问题。

在4号诱杀装置下,我要展示这样的模式:

$modal.modal();

这在《诱杀5号令》中没有任何规定,因此我改变如下:

$modal.show();

这样做,但我猜测它不再使用诱杀装置模式逻辑。 它只是使形式变得明显。 无论是哪种方式,都防止正常的开除逻辑发挥作用。

正确的辛迪加是:

$modal.modal( show );

You can try adding a function for .btn-close.

let modal = new bootstrap.Modal( #date-filter-modal )
modal.hide()

$( #open-modal ).on( click , function() {
  var $modal = $( #date-filter-modal );
  modal.show();
});

$( .btn-close ).on( click , function() {
  var $modal = $( #date-filter-modal );
  modal.hide();
});
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">

<button id="open-modal" type="button" class="btn btn-primary">Open Modal</button>

<div id="date-filter-modal" class="modal" tabindex="-1" role="dialog">
  <form method="get">
    <input type="hidden" name="ftype" />
    <input type="hidden" name="fid" />
    <div class="modal-dialog" role="document">
      <div class="modal-content">
        <div class="modal-header">
          <h5 class="modal-title"></h5>
          <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
        </div>
        <div class="modal-body">
          <div class="row">
            <div class="col-md-6">
              <div class="form-group">
                <label class="control-label">Start Date</label>
                <input class="form-control start-date" type="date" />
              </div>
            </div>
            <div class="col-md-6">
              <div class="form-group">
                <label class="control-label">End Date</label>
                <input class="form-control end-date" type="date" />
              </div>
            </div>
          </div>
        </div>
        <div class="modal-footer d-flex justify-content-between">
          <div>
            <button type="button" class="clear-date-filter btn btn-danger">Clear</button>
          </div>
          <div>
            <button type="submit" class="btn btn-success">Set Filter</button>
            <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
          </div>
        </div>
      </div>
    </div>
  </form>
</div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>

由于@ruleboy21解释了需要启动的模式,该星群为我工作,但我能够利用更适合我使用的在线文字取得同样的结果:

<script>bootstrap.Modal.getOrCreateInstance(document.getElementById( date-filter-modal )).show()</script>

This is how I solved hiding my modal window programmatically.

let modal = bootstrap.Modal.getInstance(document.getElementById("modal_id"));
modal.hide();




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签