同じ問題がありました。将来誰かがこれに遭遇し、スクロールが必要な複数のモーダルに問題がある場合に備えて、ここにこれを書きますします(私はBootstrap 3.3.7を使用しています)
私がしたことは、私の最初のモーダル内に次のようなボタンがあることです。
<div id="FirstId" data-dismiss="modal" data-toggle="modal" data-target="#YourModalId_2">Open modal</div>
最初のボタンを非表示にしてから2番目のモーダルを表示し、2番目のモーダルでは次のような閉じるボタンがあります。
<div id="SecondId" data-dismiss="modal" data-toggle="modal" data-target="#YourModalId_1">Close</div>
したがって、これにより2番目のモーダルが閉じて最初のモーダルが開き、スクロールを機能させるために、.cssファイルに次の行を追加しました。
.modal {
overflow: auto !important;
}
PS:ちなみに、これらのモーダルは個別に用意する必要があります。最初のモーダルを非表示にするため、マイナーモーダルを最初のモーダルにネストすることはできません。
したがって、ブートストラップモーダルの例に基づく完全な例を次に示します。
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
Launch demo modal
</button>
<!-- Modal 1 -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
Add lorem ipsum here
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal" data-toggle="modal" data-target="#exampleModal2">
Open second modal
</button>
</div>
</div>
</div>
</div>
<!-- Modal 2 -->
<div class="modal fade" id="exampleModal2" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" data-toggle="modal" data-target="#exampleModal">Close</button>
</div>
</div>
</div>
</div>