admin管理员组文章数量:1289877
I want to use a Modal from the Bootstrap library.
When I click the button, the Modal is displayed, but it is transparent.
I can't figure out why this is.
JSFiddle link: /
This is my HTML:
<div id="loginWindow" tabindex="-1" role="dialog" class="modal fade" aria-hidden="true">
<div class="modal-dialog">
<div class="model-content">
<div class="modal-header">
<button type="button" data-dismiss="modal" class="close">
<span aria-hidden="true">×</span>
<span class="sr-only">Close</span>
</button>
<h4 id="loginLabel" class="modal-title">Log in</h4>
</div>
<div class="modal-body">
<input id="email" type="text">
</div>
<div class="modal-footer">
<p>blablabla</p>
</div>
</div>
</div>
</div>
This is my JavaScript:
$(document).ready( function() {
// set focus when modal is opened
$('#loginWindow').on('shown.bs.modal', function () {
$('#email').focus();
});
// everytime the button is pushed, open the modal, and trigger the shown.bs.modal event
$('#loginButton').click(function () {
$('#loginWindow').modal({
show: true
});
});
});
I want to use a Modal from the Bootstrap library.
When I click the button, the Modal is displayed, but it is transparent.
I can't figure out why this is.
JSFiddle link: http://jsfiddle/0cqkdjey/
This is my HTML:
<div id="loginWindow" tabindex="-1" role="dialog" class="modal fade" aria-hidden="true">
<div class="modal-dialog">
<div class="model-content">
<div class="modal-header">
<button type="button" data-dismiss="modal" class="close">
<span aria-hidden="true">×</span>
<span class="sr-only">Close</span>
</button>
<h4 id="loginLabel" class="modal-title">Log in</h4>
</div>
<div class="modal-body">
<input id="email" type="text">
</div>
<div class="modal-footer">
<p>blablabla</p>
</div>
</div>
</div>
</div>
This is my JavaScript:
$(document).ready( function() {
// set focus when modal is opened
$('#loginWindow').on('shown.bs.modal', function () {
$('#email').focus();
});
// everytime the button is pushed, open the modal, and trigger the shown.bs.modal event
$('#loginButton').click(function () {
$('#loginWindow').modal({
show: true
});
});
});
Share
Improve this question
asked Dec 8, 2014 at 18:24
JNevensJNevens
12k9 gold badges50 silver badges73 bronze badges
4
- Can you create a jsfiddle or plunker? – mellis481 Commented Dec 8, 2014 at 18:26
-
check that your CSS does not have the property
backdrop
set tofalse
- Also, are you Boostrap 2.x syntax with Boostrap 3.x libraries? – blurfus Commented Dec 8, 2014 at 18:27 - I have Bootstrap 3. Which part is Bootstrap 2 syntax? – JNevens Commented Dec 8, 2014 at 18:32
- Ah, I see the fiddle now, let me check it – blurfus Commented Dec 8, 2014 at 18:33
1 Answer
Reset to default 15Found it:
<div class="model-content">
Should be:
<div class="modal-content"> // Notice the a
That should fix it.
Cheers!
本文标签: javascriptBootstrap why is my Modal transparentStack Overflow
版权声明:本文标题:javascript - Bootstrap: why is my Modal transparent? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741487664a2381478.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论