【发布时间】:2020-12-29 11:37:51
【问题描述】:
我的引导模式没有显示,我只是得到了褪色的屏幕。它可以在手机和平板电脑上运行,但不能在台式机上运行?有人知道为什么会这样吗?
代码如下:
<button type="button" class="btn btn-primary" data-toggle="modal" data-toggle="modal" data-target=".bd-example-modal-lg">Open Modal</button>
<div class="modal fade bd-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">×</button>
</div>
<div class="modal-body">
{{ module.author_image }}
<p>
{{ module.author_name }}
</p>
{{ module.author_description }}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
css:
.modal {
text-align: center;
padding: 0!important;
overflow: visible;
display: block;
}
.modal:before {
content: '';
display: inline-block;
height: 100%;
vertical-align: middle;
margin-right: -4px; /* Adjusts for spacing */
}
.modal-dialog {
display: inline-block;
text-align: left;
vertical-align: middle;
}
body.modal-open {
overflow: visible;
position: absolute;
width: 100%;
height:100%;
}
js:
$('#myModal').on('shown.bs.modal', function (e) {
$('#myInput').trigger('focus')
})
任何建议都会有所帮助,谢谢! :)
【问题讨论】:
-
你为什么要使用所有的覆盖css?
-
在打开模式时,您希望将焦点放在 myInput 元素上,但您没有为其附加任何输入 html 标记???
-
你想达到什么目的??
-
@nikhilsugandh 不,再次准备好我的问题 :)
标签: javascript html jquery css twitter-bootstrap