Javascript 引导3模式上的额外滚动条
我已经浏览了这个网站和其他网站上的各种问题,并尝试了它们各自的修复,但我没有找到任何一个适合我的。每当我打开模态时,就会添加一个额外的滚动条。额外的滚动条是模态的,我知道,我想做的是隐藏背景页面的滚动条,这样可以防止背景滚动。现在,当模式的滚动完成时,背景开始滚动 这是我的模态代码:Javascript 引导3模式上的额外滚动条,javascript,jquery,html,css,twitter-bootstrap,Javascript,Jquery,Html,Css,Twitter Bootstrap,我已经浏览了这个网站和其他网站上的各种问题,并尝试了它们各自的修复,但我没有找到任何一个适合我的。每当我打开模态时,就会添加一个额外的滚动条。额外的滚动条是模态的,我知道,我想做的是隐藏背景页面的滚动条,这样可以防止背景滚动。现在,当模式的滚动完成时,背景开始滚动 这是我的模态代码: <div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLab
<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalTitle">Modal title</h4>
</div>
<div class="modal-body">
<p id="myModalContent"></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"> <span class="glyphicon glyphicon-thumbs-up"></span>
</button>
<button type="button" class="btn btn-default center"> <span class="glyphicon glyphicon-thumbs-down"></span>
</button>
</div>
</div>
</div>
</div>
&时代;
情态标题
如何防止背景滚动?只需添加
body.modal-open {
overflow: hidden!important;
}
到你的CSS
请为此问题创建JSFIDLE…在您创建的演示中,我如何才能看到模态?@RahulGupta单击任何新闻项。谢谢,但现在背景中的面板移到右侧:/I更新了我的答案。但是内容总是会有一个小的移动,因为我们需要隐藏滚动条来禁用滚动。我已经添加了
left:6.5%
,现在它工作得很好。我很高兴你能自己来计算。谢谢。)如果您编辑您的答案并添加该内容,我将接受它。:)