これについて多くの人が尋ねてきましたが、高さがブラウザを超えている場合、スクロールするブートストラップのモーダルコンテンツを設定します。
モーダルの高さがブラウザの内部高さを超える場合は、赤い枠線で区切られたDivにブラウザバー内にモーダルを維持するためのスクロールバーが必要です。
#scrollbox {
border: 1px solid red;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<input type="button" data-toggle="modal" data-target="#myModal" value="Launch Modal">
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body">
Hello, below is some text in a div that should start scrolling if the height of the modal exceeds the browser.
<p><div id="scrollbox">
the<br>quick<br>brown<br>fox<br>
the<br>quick<br>brown<br>fox<br>
the<br>quick<br>brown<br>fox<br>
the<br>quick<br>brown<br>fox<br>
the<br>quick<br>brown<br>fox<br>
the<br>quick<br>brown<br>fox<br>
the<br>quick<br>brown<br>fox<br>
the<br>quick<br>brown<br>fox<br>
the<br>quick<br>brown<br>fox<br>
the<br>quick<br>brown<br>fox<br>
</div>
</div>
</div>
</div>
</div>
ありがとう、ちょうどCSSの高さを 'max-height'に変更する必要があります:-) –
@DanielWilliams完了: –
また、私は以前この' 100vh'を見たことがありません。私はいつも 'calc(100%-')を使用しました。 –