我在同一页面上有两个模态。其中之一显示很好。但是,第二个没有显示。仅显示黑色的“不透明”屏幕,而不显示模式本身。我读过其他文章,似乎对我没有任何帮助。
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<button type="button" class="btn btn-primary mt-4 ml-2 mb-4" data-toggle="modal" data-target="#modalPublishWithAccount">Usuario registrado quiere publicar</button>
<button type="button" class="btn btn-success mt-4 ml-2 mb-4" data-toggle="modal" data-target="#solicitarArriendoWithAccountModal">Usuario registrado quiere publicar</button>
<!-- MODAL THAT WORKS -->
<div class="modal fade bd-example-modal-lg registration-modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" id="modalPublishWithAccount">
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
<div class="modal-content registration-modal-content">
<div class="modal-header registration-modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body modal-body-img registration-modal-body text-center col-lg-8 col-md-8 pb-5 pt-0 mx-auto">
I'm the modal that works
</div>
</div>
</div>
</div>
<!-- /MODAL THAT WORKS -->
<!-- MODAL THAT DOESN'T WORK -->
<div class="modal fade bd-example-modal-lg registration-modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" id="solicitarArriendoWithAccountModal" style="z-index:10;">
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
<div class="modal-content registration-modal-content">
<div class="modal-header registration-modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body modal-body-img registration-modal-body text-center col-lg-8 col-md-8 pb-5 pt-0 mx-auto">
I'm the modal that doesn't work
</div>
</div>
</div>
</div>
<!-- /MODAL THAT DOESN'T WORK -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
答案 0 :(得分:0)
如果将内联z:index更改为10000或大于10的内容,则可以与模式进行交互。
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<button type="button" class="btn btn-primary mt-4 ml-2 mb-4" data-toggle="modal" data-target="#modalPublishWithAccount">Usuario registrado quiere publicar</button>
<button type="button" class="btn btn-success mt-4 ml-2 mb-4" data-toggle="modal" data-target="#solicitarArriendoWithAccountModal">Usuario registrado quiere publicar</button>
<!-- MODAL THAT WORKS -->
<div class="modal fade bd-example-modal-lg registration-modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" id="modalPublishWithAccount">
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
<div class="modal-content registration-modal-content">
<div class="modal-header registration-modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body modal-body-img registration-modal-body text-center col-lg-8 col-md-8 pb-5 pt-0 mx-auto">
I'm the modal that works
</div>
</div>
</div>
</div>
<!-- /MODAL THAT WORKS -->
<!-- MODAL THAT DOESN'T WORK -->
<div class="modal fade bd-example-modal-lg registration-modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" id="solicitarArriendoWithAccountModal" style="z-index:10000;">
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
<div class="modal-content registration-modal-content">
<div class="modal-header registration-modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body modal-body-img registration-modal-body text-center col-lg-8 col-md-8 pb-5 pt-0 mx-auto">
I'm the modal that doesn't work
</div>
</div>
</div>
</div>
<!-- /MODAL THAT DOESN'T WORK -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
答案 1 :(得分:0)
您具有使用z-index的内联样式。只需完全删除z-index即可; Bootstrap为您处理级别。
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<button type="button" class="btn btn-primary mt-4 ml-2 mb-4" data-toggle="modal" data-target="#modalPublishWithAccount">Usuario registrado quiere publicar</button>
<button type="button" class="btn btn-success mt-4 ml-2 mb-4" data-toggle="modal" data-target="#solicitarArriendoWithAccountModal">Usuario registrado quiere publicar</button>
<!-- MODAL THAT WORKS -->
<div class="modal fade bd-example-modal-lg registration-modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" id="modalPublishWithAccount">
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
<div class="modal-content registration-modal-content">
<div class="modal-header registration-modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body modal-body-img registration-modal-body text-center col-lg-8 col-md-8 pb-5 pt-0 mx-auto">
I'm the modal that works
</div>
</div>
</div>
</div>
<!-- /MODAL THAT WORKS -->
<!-- MODAL THAT DOESN'T WORK -->
<div class="modal fade bd-example-modal-lg registration-modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" id="solicitarArriendoWithAccountModal">
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
<div class="modal-content registration-modal-content">
<div class="modal-header registration-modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body modal-body-img registration-modal-body text-center col-lg-8 col-md-8 pb-5 pt-0 mx-auto">
I'm the modal that doesn't work
</div>
</div>
</div>
</div>
<!-- /MODAL THAT DOESN'T WORK -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
答案 2 :(得分:0)
经过多次尝试,我没有关闭一个</div>
标签。就是这样!