I have used the code for my modal straight from the Bootstrap example, and have included only the bootstrap.js (and not bootstrap-modal.js). However, my modal is appearing u
This would cover all modals without messing up any of the animations or expected behavior..
$(document).on('show.bs.modal', '.modal', function () {
$(this).appendTo('body');
});
This problem can often be experienced when using things like gradients in CSS for things like backgrounds or even accordion headers.
Unfortunately, modifying or overriding core Bootstrap CSS is undesirable, and can lead to unwanted side effects. The least intrusive approach is to add data-backdrop="false"
but you may notice that the fade effect no longer works as expected.
After following recent releases of Bootstrap, version 3.3.5 seems to resolve this issue with no unwanted side effects.
Download: https://github.com/twbs/bootstrap/releases/download/v3.3.5/bootstrap-3.3.5-dist.zip
Be sure to include the CSS files and JavaScript files from 3.3.5.
You can also remove the z-index from .modal-backdrop. Resulting css would look like this.
.modal-backdrop {
}
.modal-backdrop.in {
opacity: .35;
filter: alpha(opacity=35); }
Just add two lines of CSS:
.modal-backdrop{z-index: 1050;}
.modal{z-index: 1060;}
The .modal-backdrop should have 1050 value to set it over the navbar.
I tried all options supplied above but didn't get it to work using those.
What did work: setting the z-index of the .modal-backdrop to -1.
.modal-backdrop {
z-index: -1;
}
I have also encountered this problem and none of the solutions worked for me until i figured out i actually don't need a backdrop. You can easily remove the backdrop with the folowing code.
<div class="modal fade" id="createModal" data-backdrop="false">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4>Create Project</h4>
</div>
<div class="modal-body">Not yet made</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
Note: the data-backdrop
attribute needs to be set to false
(other options: static
or true
).