问题
when my modal popup window opens, it adds a vertical scrollbar to the right of the browser window. How do i disable this? I think this is enabled when the modal window has a very large height value where it needs to scroll. i want to disable this as my form height does not exceed the window height.
回答1:
In your css add :
body {
overflow-y:hidden;
}
回答2:
I have the same problem with bootstrap 3.0.0. It seems that .modal
class has overflow-y: scroll
rule which results in scrollbar always visible.
So, you can amend this either locally:
<div class="modal" ... style="overflow-y: auto;">
...
</div>
or globally:
<style>
.modal {
overflow-y: auto;
}
</style>
回答3:
Add style to body as:
body {
padding-right: 0px !important;
overflow-y: hidden !important;
}
回答4:
If the model window height is not more than normal window height, it doesn't make any sense to display the the scroll bar. Check weather any <div></div>
used to fade the background behind the model window has extra height than the viewpoint.
来源:https://stackoverflow.com/questions/17726641/bootstrap-how-to-disable-vertical-scrollbar