close button on right of text-centered breadcrum with Bootstrap - html

So I am trying to create a modal with a centered breadcrum on top and a close button on the very right, on the same line of the breadcrum.
I am using Bootstrap 3
Here is my code:
<div class="modal container">
<div class="modal-content col-sm-6 col-sm-offset-3">
<div class="row text-center">
<div class="breadcrumb-container">
<ol class="breadcrumb modal-breadcrum">
<li class="breadcrumb-step step-one">Abonnement</li>
<li class="breadcrumb-step step-two">Inscription</li>
<li class="breadcrumb-step step-three">Paiement</li>
</ol>
<button type="button" class="close" aria-label="Close">
<span id="close-btn" aria-hidden="true">×</span>
</button>
</div>
</div>
</div>
</div>
With this, The breadcrum is at its rights place, centered on top of the modal.
But the close button is also centered, wrapped under the breadcrum.
How can I achieve this ?
What I actually want is:
<!-- some space here --> centered Breadcrum <!-- some space here --> X

OK so after some research, I found a good solution:
simply put the button out of the row, actually before the breadcrum row:
<div class="modal container">
<div class="modal-content col-sm-6 col-sm-offset-3">
<button type="button" class="close" aria-label="Close">
<span id="close-btn" aria-hidden="true">×</span>
</button>
<div class="row text-center">
<div class="breadcrumb-container">
<ol class="breadcrumb modal-breadcrum">
<li class="breadcrumb-step step-one">Abonnement</li>
<li class="breadcrumb-step step-two">Inscription</li>
<li class="breadcrumb-step step-three">Paiement</li>
</ol>
</div>
</div>
</div>
</div>
Notice that, as #Minal Chauhan mentionned, the button must have the float: right property, and he bootstrap close class gives it to the button.

Related

How to apply width to specific child ngx-bootstrap Modal from parent component CSS

I am using the following CSS code in parent component CSS file to change the width of a child modal (I am using NGX bootstrap modals).
Parent CSS:
::ng-deep .modal-dialog {
min-width: 1000px;
}
Parent HTML:
<!-- Modal -->
<div class="modal-header" style="padding-bottom: 0px">
<h2 class="modal-title" id="exampleModalLabel">Modification History</h2>
<button type="button" class="close" data-dismiss="modal" (click)="bsModalRef.hide()" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<app-mod-logs [searchInput]="searchInput"></app-mod-logs>
</div>
Child HTML:
<div class="modal-dialog filter">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">
Advanced Filter
</h5>
<button type="button"
class="close"
data-dismiss="modal"
(click)="bsModalRef.hide()"
aria-label="Close">
<span aria-hidden="true">
×
</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-4 py-3 px-lg-1 border bg-light column1">
<div class="heading">
<b>Available Objects</b>
</div>
<ul class="list-group container1">
<li class="list-group-item list-group-item-action"
[ngStyle]="{width: objectWidth}"
[class.active]="active === i"
(click)='loadKeyItems(object.KeyObject); activated(i);'
*ngFor="let object of availableObjects; let i = index;">
{{object.SourceObject}}
</li>
</ul>
</div>
<div class="col-md-4 py-3 px-lg-1 border bg-light column2">
<div class="heading">
<b>Available Items</b>
</div>
<ul class="list-group container2">
<ngx-spinner name="boxSpinner"
[fullScreen]="false"
type="ball-spin-clockwise"
size="small">
</ngx-spinner>
<li [ngStyle]="{width: availableWidth}"
class="list-group-item list-group-item-action"
(dblclick)='pushToSelected(keyItem.Id)'
(mousedown)="disableTextSelection($event)"
*ngFor="let keyItem of KeyItems">
{{keyItem.Caption}}
</li>
</ul>
</div>
<div class="col-md-4 py-3 px-lg-1 border bg-light column3">
<div class="heading">
<b>Selected Items</b>
</div>
<ul class="list-group container3">
<li [ngStyle]="{width: selectedWidth}"
class="list-group-item list-group-item-action"
(dblclick)='pushToAvailable(select.Id)'
(mousedown)="disableTextSelection($event)"
*ngFor='let select of selectedItemArray'>
{{select.Caption}}
</li>
</ul>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button"
class="btn btn-secondary"
(click)='clear()'
[disabled]='buttonDisabled'>
Clear
</button>
<button type="button"
class="btn btn-secondary"
[disabled]='buttonDisabled'>
Apply Filters
</button>
</div>
</div>
but this code applies the width of 1000px to all the children. I want this on a specific modal. And as the modal-dialog class is a parent bootstrap class of modals, I can not access it from children, so I have written the CSS in the parent. I have tried to add css class of my that specific child but it is not working as expected. (See the following code). (PS - I haven't applied any css related to this in the child CSS).
Parent modified CSS:
::ng-deep .modal-dialog .filter {
min-width: 1000px;
}
I was using modal-lg class for that specific modal so therefore I used following CSS in the Parent component.
::ng-deep .modal-lg {
min-width: 1000px !important;
}

First element of the collapse menu should show and the rest should hide angular6

I have an accordion and collapse element and I am displaying using ngFor. I need the first element to show and the remaining to be hidden everytime.
I have tried modifying the ngClass attributes but it gets applied to every element in the for loop.
<div id="accordion">
<ul *ngFor="let group of records">
<div class="card">
<div class="card-header" attr.id="heading{{group.id}}">
<h5 class="mb-0">
<button class="btn btn-link" data-toggle="collapse" attr.data-target="#collapse{{group.id}}"
aria-expanded="false" (click)='toggleIcon()' attr.aria-controls="collapse{{group.id}}">
<i [ngClass]="{'fa':true,'fa-plus':icoPlus,'fa-minus':icoMinus}"></i>
<span id='region' class='region-heading'>{{group.regionName}}</span>
</button>
</h5>
</div>
<div attr.id="collapse{{group.id}}" [ngClass]="{'collapse':true, 'show':showEnabled}"attr.aria-labelledby="heading{{group.id}}" data-parent="#accordion">
<div class="card-body " >
<ul class='country-list' *ngFor="let country of group.countryList ">
<li class='country-name'>
{{country.countryName}}
<div class='divider'></div>
</li>
<ul *ngFor="let campus of country.campusList" class="list-group list-group-flush">
<li>
<div class='row'>
<div class='col-sm'>
{{campus.campusName}}
</div>
<div class='col-sm'>
{{country.countryName}}, {{campus.cityName}}
</div>
<div class='col-sm'>
{{campus.skypeConfNumber}}
</div>
<div class='col-sm'>
<a [attr.href]="'tel:' + campus.skypeConfNumber + conferenceIdStr" (click)='clicked(country.countryName)'>
click here to join
</a>
</div>
</div>
<div class='divider'></div>
</li>
</ul>
</ul>
</div>
</div>
the expected result is the first element should be expanded and the rest should be minimized.

justify content center within modal not working

I am trying to use the justify-content-center within a modal but for some it does not render like it should..
I am trying to render a button in the middle of a div
<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">
<img class="card-img-top" src="{% static "images/manager_happy.png"%}" alt="Card image cap">
<div class="modal-body">
<h5>Improve your managerial skills by understanding who is in your team</h5>
<hr>
<div class="container">
<div class="row">
<div class="col">
<div class="price-modal-container">
<span class="modal-price-title">Price:</span><span class="modal-price">60$</span><span class="modal-Oprice">299$</span><span class="modal-discount">60% off</span>
</div>
<div class="time-price">
<i class="far fa-clock fa-spin"></i>Limited time offer discount
</div>
</div>
</div>
<div class="row justify-content-center">
<div class="col">
<span class="glyphicon glyphicon-plus"></span> Add Credit Now
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<span class="glyphicon glyphicon-plus"></span> Add Credit Now
</div>
</div>
</div>
</div>
Any idea it does not work ? is there any trouble because of the modal ?
Are you trying to render it so the button is horizontally centered? Right now it's not working because the col class takes up all the remaining width. So you can either make the content inside the column centered or make it so the column itself doesn't take up the full width.
To center the content inside the column you just need add the text-center class either to the column or by simply replacing justify-content-center on the row.
<div class="row text-center">
<div class="col">
<span class="glyphicon glyphicon-plus"></span> Add Credit Now
</div>
</div>
Alternatively you can keep the row the way it is and change the column class from col to col-auto so it won't take the full width.
<div class="row justify-content-center">
<div class="col-auto">
<span class="glyphicon glyphicon-plus"></span> Add Credit Now
</div>
</div>

Bootstrap modal of image gallary just fading the page

I'm trying to build a portfolio Page for my business but having trouble getting the Modal to work.
The javascript just executes: without the modal.
Thanks for your help!
<div class="container">
<div class="row">
<ul class="thumbnails">
<li class="col-lg-2 col-md-2 col-sm-3 col-xs-4"><img src="images/test.jpg" alt="alt-text"/></li>
</ul>
</div>
</div>
<div id="image1" class="modal hide fade" tabindex="-1">
<div class="modal-header">
<button type="btn" class="close" data-dismiss="modal"><i class="fa fa-times"></i></button>
<h3>Heading</h3>
</div>
<div class="modal-body">
<li><img src="images/test.jpg"/></li>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal">Schließen</button>
</div>
</div>
Thank you for providing an example on jsbin, this makes it much easier for us to help you.
Your problem lies within the first row of this excerpt:
<div id="image1" class="modal hide fade" tabindex="-1"> <!-- here -->
<div class="modal-header">
<button type="btn" class="close" data-dismiss="modal"><i class="fa fa-times"></i></button>
<h3>Heading</h3>
Bootstrap's .hide class is defined like this:
.hide {
display: none !important;
}
This means that whatever happens, elements with the class .hide will stay hidden. This is ensured with the !important rule.
To solve your issue, you either remove the .hide class from div#image1 like this:
<div id="image1" class="modal fade" tabindex="-1"> <!-- no hide class -->
<div class="modal-header">
<button type="btn" class="close" data-dismiss="modal"><i class="fa fa-times"></i></button>
<h3>Heading</h3>
Or you supply an onclick listener which removes the .hide class if a click occurs. Though, this should not be necessary, since Bootstrap's modal is not visible by default.

Modal behaving abnormally

I am trying to build a two column layout in a bootstrap modal. This is the code:
<div class="modal fade in" id="product-showcase-modal" tabindex="-1" role="dialog" aria-labelledby="product-showcase" aria-hidden="false" style="display: block;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<div class="container col-xs-12">
<div class="row-fluid">
<div class="col-xs-6">
<img src="http://localhost/haya/img/hijabs/dark%20grey.jpg" id="product_image" width="200px" height="auto" style="display: inline;">
</div>
<div class="col-xs-6">
<h3 id="product_name">Dark Gray</h3>
<p id="new_price">$3.00</p>
<p style="text-decoration: line-through;" id="old_price">$4.35</p>
<button class="btn btn-warning">Add to cart</button>
</div>
</div>
</div>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
And this is the result:
I have no idea why is this happening. Can anyone resolve this?
UPDATE 1:
I removed the col-xs-12 class from the container div. Now the container is in the modal's body but it's has taken a width of 100% (my screen's width). Result:
Just need to add a clearfix to the modal-body. This will fix the float item issue where the container doesn't fully expand.
Fiddle: http://jsfiddle.net/52VtD/6310/
<div class="modal-body clearfix">