Bootstrap dialog window opens behind another dialog window instead of infront - html

A dialog window is incorrectly opening behind another dialog window. I use the #modalMidWestEquipPlans data target to open the dialog window. How do I tweak the code so that the hyperlink opens the dialog window in front? Most solutions to a similar issue talk about tweaking a z-index but I do not have that in this code.
Thank you
<div class="col col mb-4">
<div class="card metro-card rounded mb-0 bg-primary">
<div class="card-body ">
<h5 class="card-title">
<button type="button" class="btn btn-primary" data-toggle="modal"
data-target="#modalEquipPlans">
Equipment
</button>
</h5>
</div>
</div>
</div>
<div class="modal fade" id="modalEquipPlans" tabindex="-1" role="dialog" aria-labelledby="modalEquipPlansTitle"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-xl" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title ModalTitleOR" id="modalEquipPlansLongTitle">Equipment</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<strong>Equipment Plans</strong>
<div class="list-group">
<!-- (other list group items removed) -->
<div class="list-group-item bg-danger h5 fake-btn">
<a class="clsPointer" data-toggle="modal"
data-target="#modalMidWestEquipPlans">
<span class="addUnderlines">AFTER CLICKING THIS HYPERLINK, THE DIALOG BOX OPENS BEHIND THIS DIALOG INSTEAD OF IN FRONT</span>
</a>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>

Related

Bootstrap fullscreen modal not working when trying to implement it with Laravel

I'm trying to display a section of my about page using a full screen modal but the modal is only opening/ showing in a small section. It only opens up a little bit when I use 'modal-dialog modal-lg' but it doesn't expand besides that. Can anyone help me fix this issue?
<!--1-->
<div class="site-section">
<div class="container">
<div class="row align-items-center mr-5">
<div class="col-lg-6 py-5 px-5">
<img src="assets/img/bee.jpg" alt="image" class="img-fluid rounded" style="width:500px;height:500px;">
</div>
<div class="col-lg-6 pl-lg-5 ">
<h3 class="mt-4 font-weight-bold">About Us</h3>
<p class="text-justify pt-0 mr-5"> is a publishing company working with a non- denominational ministry.
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
Load More
</button>
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-fullscreen-xxl-down">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
<button type="button" class="btn-close" data-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
</div>
</div>
Try change your bootstrap class form this :
<div class="modal-dialog modal-fullscreen-xxl-down">
To this :
<div class="modal-dialog modal-fullscreen">
Also be sure that you have Bootstrap version 5 installed in your laravel project. Fullscreen modals are only included by default in Bootstrap 5 not in the previous ones: https://getbootstrap.com/docs/5.0/components/modal/#fullscreen-modal

Why is my image not showing in the modal?

Hello everyone I am trying to make a modal which shows an image when a button is clicked. But I ran into a problem and dont seem to understand why my image is not showing in my modal. I am using bootstrap 4.5.2 to make this modal.
When I use this url inside of the src: //placehold.it/600x400. The image works fine but when I link the same image from my folder named resources the image does not load.
Here is my code
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalCenter">
Launch demo modal
</button>
<!-- Modal -->
<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body" id="dynamic-content">
<img src="Resources/600x400.png" alt="officeMap" class="img-fluid">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
Here is my path
Changing the file path to PlanPage/Resources/600x400.png solved the problem.

How do I make multiple MDB modals on the same page and have different content in each modal pop up?

How do I make multiple MDB modals on the same page and have different content in each modal pop up? Currently the content in the modal-body of the last modal will show up when either of the modals are clicked even though I have separate content in each modal-body? I used the MDB modal markup from here: https://mdbootstrap.com/docs/jquery/modals/generator/ Why is this?
Here is the my code:
<!-- Modal 1 -->
<button type="button" mdbBtn color="primary" class="relative waves-light p-2 modal-btns" (click)="basicModal.show()" mdbWavesEffect
*ngIf="showBasic">
Modal 1
</button>
<div mdbModal #basicModal="mdbModal" class="modal fade right" tabindex="-1" role="dialog"
aria-labelledby="myBasicModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close pull-right" aria-label="Close" (click)="basicModal.hide()">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title w-100" id="myModalLabel">Content 1</h4>
</div>
<div class="modal-body">
Content 1
</div>
<div class="modal-footer justify-content-center">
<button type="button" mdbBtn color="secondary" class="waves-light" aria-label="Close"
(click)="basicModal.hide()" mdbWavesEffect>Close</button>
<button type="button" mdbBtn color="primary" class="relative waves-light" mdbWavesEffect>OK!</button>
</div>
</div>
</div>
</div>
<!-- Modal 1 -->
<!-- Modal 2 -->
<button type="button" mdbBtn color="primary" class="relative waves-light p-2 modal-btns" (click)="basicModal.show()" mdbWavesEffect
*ngIf="showBasic">
Modal 2
</button>
<div mdbModal #basicModal="mdbModal" class="modal fade right" tabindex="-1" role="dialog"
aria-labelledby="myBasicModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close pull-right" aria-label="Close" (click)="basicModal.hide()">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title w-100" id="myModalLabel">Content 2</h4>
</div>
<div class="modal-body">
Content 2
</div>
<div class="modal-footer justify-content-center">
<button type="button" mdbBtn color="secondary" class="waves-light" aria-label="Close"
(click)="basicModal.hide()" mdbWavesEffect>Close</button>
<button type="button" mdbBtn color="primary" class="relative waves-light" mdbWavesEffect>OK!</button>
</div>
</div>
</div>
</div>
<!-- Modal 2 -->
#basicModal id is used in both modals. This value should be unique.
You need to change this value in the second modal code, for example:
<!-- Modal 2 -->
<button type="button" mdbBtn color="primary" class="relative waves-light p-2 modal-btns" (click)="secondModal.show()" mdbWavesEffect
*ngIf="showBasic">
Modal 2
</button>
<div mdbModal #secondModal="mdbModal" class="modal fade right" tabindex="-1" role="dialog"
aria-labelledby="myBasicModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close pull-right" aria-label="Close" (click)="basicModal.hide()">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title w-100" id="myModalLabel">Content 2</h4>
</div>
<div class="modal-body">
Content 2
</div>
<div class="modal-footer justify-content-center">
<button type="button" mdbBtn color="secondary" class="waves-light" aria-label="Close"
(click)="secondModal.hide()" mdbWavesEffect>Close</button>
<button type="button" mdbBtn color="primary" class="relative waves-light" mdbWavesEffect>OK!</button>
</div>
</div>
</div>
</div>
<!-- Modal 2 -->

Why Does My Modal Window got Opacity Down along with other Elements When Triggered

I have been working on my client's project, in which I have to include a modal window. The Model window should popup when the link is clicked.
But when the modal window gets triggered, the opacity of all elements decrease including the modal window.
But the Modal window's Opacity should not be decreased by default is nt it ?
This is the HTML code of my modal window:
<div id="myModal" class="modal fade" role="dialog" style="background-color: white">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
Here is my triggering html code
<div class="col-md-6 col-sm-12">
<div class="block-image-round margin-top-120">
<a href="#" data-toggle="modal" data-target="#myModal">
<img src="images/banners/1.png" style="width:100%; " alt="">
</a>
</div>
</div>
Modal window part is sibling off the triggering HTML
When The snippet running independently
But when the same snippet mentioned here used in my project code
Click this link for Example
[1]: https://plnkr.co/edit/aEbvvOWGHGQAoLf2ImiF?p=preview
Hope this will be useful to you
Try this code
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="col-md-6 col-sm-6">
<div class="block-image-round margin-top-120">
<img src="http://placehold.it/200/300" style="width:100%; " alt="" data-toggle="modal" data-target="#myModal">
</div>
</div>
<div id="myModal" class="modal fade" role="dialog" style="background-color: white">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>

button for 2nd modal won't open the modal

I have 2 buttons next to each other. The first opens a modal with the data-target of #myModal and the second button opens it with the data-taget of #largeModalTwo. The problem is, the first works fine but clicking the 2nd button only dims the screen, it doesn't open any modal.
this is bootstrap 4, could this be a bug with it?
here is the codepen
<div id="fullWidthContButtons">
<div class="container-fluid centerthisouter" style="margin-top: 25px;">
<div class="page-header centerthisinner centerthisouter">
<button type="button" class="btn btn-primary modalLaunch" data-toggle="modal" data-target="#myModal">
<h3 class="title">test data</h3> <i class="fa fa-external-link open-seseme" aria-hidden="true"></i> </button>
</div>
</div>
<div class="container-fluid centerthisouter" style="margin-top: 25px;">
<div class="page-header centerthisinner centerthisouter">
<button type="button" class="btn btn-primary modalLaunch" data-toggle="modal" data-target="#largeModalTwo">
<h3 class="title">test data 2</h3> <i class="fa fa-external-link open-seseme" aria-hidden="true"></i> </button>
</div>
</div>
</div>
<div class="modal fade bd-example-modal-lg" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Load JSON</h4> </div>
<div class="modal-body centerthisouter">
<button type="button" class="btn btn-primary centerthisinner sm-margin" id="loadJson">Load JSON file to create table</button>
<table class="table table-striped" id="data_table" /> </div>
</div>
</div>
</div>
<div id="largeModalTwo" class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content"> ... </div>
</div>
</div>
No bug in Bootstrap just a super minor error in your HTML. <table> properties are not self-closing in HTML, as you have in your first modal example. I think this was throwing off the modal JS from bootstrap because the element wasn't ever closed.
A minor code change in the modal body and you are good to go:
<div class="modal-body centerthisouter">
<button type="button" class="btn btn-primary centerthisinner sm-margin" id="loadJson">
Load JSON file to create table
</button>
<table class="table table-striped" id="data_table"></table>
</div>
Revised codepen:
http://codepen.io/staypuftman/pen/wzNVxP