Bootstrap : how to disable vertical scrollbar?

自古美人都是妖i 提交于 2019-11-29 05:53:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!