Javascript 在引导模式中删除滚动条 教育 印度管理学院,2009-2011 印度科学院 技术,2004-2008年 &时代; 教育类 毕业后: 毕业: 接近 保存更改
这是我的密码。当我点击编辑按钮时,我想要一个模态。模式出现在我的页面中,当我单击关闭按钮时消失。但使用modal时,它也会显示滚动条。如何从代码中删除滚动条?您可以设置模态体的高度Javascript 在引导模式中删除滚动条 教育 印度管理学院,2009-2011 印度科学院 技术,2004-2008年 &时代; 教育类 毕业后: 毕业: 接近 保存更改,javascript,jquery,html,css,twitter-bootstrap-3,Javascript,Jquery,Html,Css,Twitter Bootstrap 3,这是我的密码。当我点击编辑按钮时,我想要一个模态。模式出现在我的页面中,当我单击关闭按钮时消失。但使用modal时,它也会显示滚动条。如何从代码中删除滚动条?您可以设置模态体的高度 <span class="education"style="font-size:170%;line-height:150%;"> Education <br> <small style=" color:gray;font-size:60%;">
<span class="education"style="font-size:170%;line-height:150%;"> Education
<br>
<small style=" color:gray;font-size:60%;">
Indian Institute of Managment,2009-2011
</small>
<br>
<small style=" color:gray;font-size:60%;"> Indian Institute of
Technology,2004-2008
</small>
<br>
<a data-toggle="modal" href="#education" style="float:right;font-size:60%;">
<small> Edit
</small>
</a>
<div class="modal fade " id="education">
<div class="modal-dialog ">
<div class="modal-content light">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×
</button>
<h4 class="modal-title">Education
</h4>
</div>
<div class="modal-body">
<form>
<fieldset>
<label for="post-graduation">post-graduation:
</label>
<input type="text" name="post-graduation" id="inputbox"
class="text ui-widget-content ui-corner-all" />
<label for="graduation">graduation:
</label>
<input type="text" name="graduation" id="inputbox"
class="text ui-widget-content ui-corner-all" />
</fieldset>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</span>
在Bootstrap3中,CSS将第二个条放在那里(模态类)。您可以通过以下方式进行更改:
.modal-body {
max-height: 600px;
}
您应该在引导类中隐藏滚动条,然后删除
正文
的右边距
这里是css
代码:
.modal {
overflow-y: auto;
}
在show.bs.modal
事件中:
#modalElementId
{
overflow: hidden;
}
您需要删除
正文
中的类
模式打开
,检查:
.modal-open{
margin-right:0px !important;
}
在我的例子中,我想在全屏上显示一个图像,所以要实现这一点,我必须删除模式填充(在滚动条上显示),并添加一些CSS。例如:
$('#modalElementId').on('hidden.bs.modal', function (e) {
$('body').removeClass('modal-open');
});
注意:我正在使用Bootstrap4这可能有助于您。。。
$('#modalElementId').on('hidden.bs.modal', function (e) {
$('body').removeClass('modal-open');
});
<!-- Image Modal -->
<div class="modal fade p-0" id="zoomImageModal" tabindex="-1" role="dialog" aria-labelledby="zoomImageModal"
aria-hidden="true">
<div class="modal-dialog modal-full" role="img">
<div class="modal-content">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<div class="m-auto">
<img class="img-fluid" src="{{zoomPathImage}}" alt="zoomPathImage" [title]="zoomPathImage">
</div>
</div>
</div>
</div>
.modal-full {
min-width: 100%;
margin: 0;
}
.modal-full .modal-content {
min-height: 100vh;
}