i have this page that has two buttons divided By two clo-md-6 :
i want when i click in the button the first button become col-md-9 and the other col-md-3 and the same for the inverse
i don t know how to do it in angular
This is my HTML :
<div class="container-fluid">
<div class="row">
<!-- $("#btn1").parentElement.parentElement.className= "col-3"-->
<!--------------------THE FIRST BUTTON----------------------------->
<div class="col-xl-6" [class.col-xl-9]="isclicked">
<div class="card">
<button type="button" id="btn1" class="btn btn-primary" (click)="AfficherRecherche()">Agent professionnelle</button>
<div class="card-body" *ngIf="isclicked">
<h4 class="header-title mt-0 mb-4">Agent Professionnelle</h4>
<aw-wizard>
<aw-wizard-step class="sw-main sw-theme-default">
<form [formGroup]="searchForm">
<div class="row">
<div class="col-12">
<div class="form-group row mb-3">
<input type="text" class="form-control" (keyup)="searchTerm.next($event)" formControlName="search" placeholder="Rechercher ..." (input)="search()" [(ngModel)]="searchText" />
<div *ngIf="loading">
<p class="search-message">Searching</p>
<div class="lds-ellipsis">
<!-- -------------------------------THE SEOND BUTTON------------------------------------------------------------------ -->
<div class="col-xl-6" [class.col-xl-3]="isclicked">
<div class="card">
<div class="btn-group">
<button id="btn2" type="button" class="btn btn-primary" (click)="AfficherAgentpar()">Agent Partculier</button>
</div>
this is my component :
AfficherRecherche() {
this.isclicked = !this.isclicked;
}
AfficherAgentpar() {
this.agentparclick = !this.agentparclick;
}
You should trigger classes on click. So for example:
In your TS file declare a variable with a boolean:
public resize: boolean;
In your HTML you have 2 divs and a button:
<div class="clo-md-6" [class.col-md-9]="resize"></div>
<div class="clo-md-6" [class.col-md-3]="resize"></div>
<button (click)="resize != resize">Trigger me</button>
What happens is the following: When the button gets clicked it changes the value of our resize boolean. Since this is false by default, it'll trigger to true. When resize is true, the first div will be assigned the col-md-9 class, and the second div will be assigned the col-md-3 class. If you click the button again, the divs will go back to being 50/50.
Related
I am having a simple bootstrap popover and I have placed it inside panel body. It works great when I place popover outside the panel body. But I am not sure why it is not working when I place same popover inside panel body.
PopOver Inside Panel Body
<div class="row">
<div class="col-md-12">
<div style="border:1px solid black; margin-top:5px; margin-bottom:5px;">
<input id="rbtnTab1" type="radio" name="tabs" checked>
<label id="lblTab1" for="rbtnTab1">Tab 1</label>
<section id="content1">
<div>
<div class="col-xs-4 col-md-offset-4">
<div class="panel panel-default" style="margin-top:10px">
<div class="panel-heading text-center" style="font-size:15px;font-weight:bold; background-color:#4D94CE; color:white;"><i class="fa fa-users" style="font-size:x-large"></i><br />Panel Heading</div>
<div class="panel-body text-center" style="height:60px;font-size:15px">
<button type="button" class="btn btn-info" data-toggle="popover" title="Popover title" data-content="A larger popover to demonstrate the max-width of the Bootstrap popover.">Large popover</button>
</div>
</div>
</div>
</div>
<button type="button" class="btn btn-info" data-toggle="popover" title="Popover title" data-content="A larger popover to demonstrate the max-width of the Bootstrap popover.">Large popover</button>
</section>
</div>
</div>
</div>
JQuery code for bootstrap popover
$('[data-toggle="popover"]').popover({
placement: 'top',
trigger: 'hover'
});
Popover outside the panel (This works great)
<button type="button" class="btn btn-info" data-toggle="popover" title="Popover title" data-content="A larger popover to demonstrate the max-width of the Bootstrap popover.">Large popover</button>
I have the following html code to generate a basic card using bootstrap 4.
I want to change the style of the card when the card is clicked. However, if the button is clicked, I dont want the style to change.
At the moment, when I click test1 button, I will also activate the function onCardClick().
Is there a way to do this such that when I click on the test button1 only Test1() executes
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="card" (click)="onCardClick()">
<div class="card-block">
<h4 class="card-title d-inline">Some Title</h4>
<button class="btn btn-primary" (click)="onTest1()">test1</button>
<button class="btn btn-primary" (click)="onTest2()">test2</button>
</div>
</div>
</div>
You could try this to stop the event from bubbling up the dom:
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="card"
(click)="onCardClick()">
<div class="card-block">
<h4 class="card-title d-inline">Some Title</h4>
<button class="btn btn-primary"
(click)="onTest1($event)">test1
</button>
<button class="btn btn-primary"
(click)="onTest2($event)">test2
</button>
</div>
</div>
</div>
</div>
</div>
And in your component:
import {Component} from "#angular/core"
#Component({
selector: 'test',
})
export class Test
{
onTest1(event)
{
event.stopPropagation();
//or event.preventDefault()
//stuff to run
}
onTest2(event)
{
event.stopPropagation();
//stuff to run
}
}
Im trying to create a navigation bar for my table using twitter bootstrap.
The end result would look something like this
Im trying to use bootstraps grid system for this and seem to have gotten the showing rows part to look as planned but cant get the buttons to be responsive when the user switches to mobile.
HTML
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-8"> <!-- controls !-->
<div class="col-xs-12 col-sm-12">
Back
</div>
<div class="col-xs-12 col-sm-12">
First
</div>
<div class="col-xs-12 col-sm-12">
Previous
</div>
<div class="col-xs-12 col-sm-12">
Next
</div>
<div class="col-xs-12 col-sm-12">
Last
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4"><!-- page number !-->
<div class="pull-right">
<span>Showing rows 1 to 10 of 20</span>
</div>
</div>
</div>
</div>
The buttons seem to only render on top of each other.
Here is a jsfiddle showing whats happening.
What about a button group?
<div class="btn-group" role="group" aria-label="...">
<div class="btn-group" role="group">
<button type="button" class="btn btn-default">Back</button>
</div>
<div class="btn-group" role="group">
<button type="button" class="btn btn-default">First</button>
</div>
<div class="btn-group" role="group">
<button type="button" class="btn btn-default">Previous</button>
</div>
<div class="btn-group" role="group">
<button type="button" class="btn btn-default">Next</button>
</div>
<div class="btn-group" role="group">
<button type="button" class="btn btn-default">Last</button>
</div>
<div class="btn-group" role="group">
<span>Showing rows 1 to 10 of 20</span>
</div>
</div>
EDIT added in showing rows and made more responsive on mobile devices
Each of your button is wrapped in a div with a bootstrap class "col-sm-12" and "col-xs-12" . This means that each of those div will occupy 12 columns EACH, thereby leaving no column for other buttons or divs to lie on the same row.
To obtain the desired result, change their classes to "col-sm-2" so that each button's div occupies two columns out of twelve.
Hi guys using bootstrap and struggling to understand how to get a my main div box to have other divs inside of it
For example i am trying to make this:
This big box is just a div.
What i got so far:
<div class="container">
<div class="MainBox">
<div class="Leftbox">
<h3>Box</h3>
<div class="btn-group-vertical">
<button type="button" class="btn btn-primary btn-responsive">P</button>
<button type="button" class="btn btn-success btn-responsive">B</button>
<button type="button" class="btn btn-success btn-responsive">L</button>
<button type="button" class="btn btn-success btn-responsive">R</button>
<button type="button" class="btn btn-success btn-responsive">T</button>
<button type="button" class="btn btn-success btn-responsive">F</button>
</div>
</div>
<div class="CentreBox">
</div>
</div>
</div>
I am not so sure how to do the boxes on the right hand side , i have tried different methods but it mucks up the whole div. Any help would be great. Thanks xx
You really want to look into Bootstraps grid system, as suggested by #Sringland in his comments, found here: Bootstrap Docs
The grid system creates 12 columns on any screen size (from xtra small - large), and can be defined as a class by col-(screensize)-(span). For example - if you want 12 columns spanning a large sized screen add the class: col-lg-12 to your div.
These columns are "embeddable", and will create a new 12-column layout inside one another. So if you want to split up an 8 column layout into two equal sized containers within it, it would like like this:
<div class="col-md-8">
<div class="col-md-6"> </div>
<div class="col-md-6"> </div>
</div>
So remember, each time you "open" a column regardless of its size, that container will have another 12 columns to work with.
After all this is said, your layout will look something like this:
<div class="row height-500px">
<div class="container">
<div class="col-md-3 border height-500px">
<!-- Content goes here -->
</div>
<div class="col-md-7 border height-500px">
<!-- CONTENT GOES HERE -->
</div>
<div class="col-md-2 height-500px">
<div class="col-md-12 height-125px border">
<!-- Content goes here -->
</div>
<div class="col-md-12 height-125px border">
<!-- Content goes here -->
</div>
<div class="col-md-12 height-125px border">
<!-- Content goes here -->
</div>
<div class="col-md-12 height-125px border">
<!-- Content goes here -->
</div>
</div>
</div>
</div>
Here is a link to a Bootply to see it in action. Please see the bootply for a better understanding of the height classes and border classes. I created these simply to represent your layout.
Now, gutters (the space between the columns) are not working as intended, and I hope someone help there. But, hopefully this will be a good starting point for you.
Jus try using bootstrap grid system. I used buttons for the right column, but you can use whatever you need.
<div class="container MainBox border-on">
<div class="col-md-2 left border-on">
<h3>Box</h3>
<div class="btn-group-vertical">
<button type="button" class="btn btn-primary btn-responsive">P</button>
<button type="button" class="btn btn-success btn-responsive">B</button>
<button type="button" class="btn btn-success btn-responsive">L</button>
<button type="button" class="btn btn-success btn-responsive">R</button>
<button type="button" class="btn btn-success btn-responsive">T</button>
<button type="button" class="btn btn-success btn-responsive">F</button>
</div>
</div>
<div class="col-md-8 CentreBox border-on">
<h3>
center
</h3>
</div>
<div class="col-md-2 right border-on">
<h3>
right
</h3>
<div class="col-md-12">
One
</div>
<div class="col-md-12">
Two
</div>
<div class="col-md-12">
Three
</div>
<div class="col-md-12">
Four
</div>
</div>
</div>
I have a question that has been surely asked 10000 times already but I don't really understand the answers.
I want to make something simple : divide my screen in 3 columns, add some buttons on the 1 column, a google map in the second one and other buttons in the 3rd one.
How can I manage to do that properly?
For moment I added the buttons where I wanted, but when it comes to manage the map, I have problems usually with the size.
<div class="container">
<div class="row">
<div class="col-lg-4">
<button type="button" class="btn btn-primary btn-lg">1</button>
<button type="button" class="btn btn-default btn-lg">2</button>
</div>
<div class="col-lg-4">
<div id="map-container" style="width: 500px; height: 300px;"></div>
</div>
<div class="col-lg-4">
<form class>
<b>Point A : <input type="text" class="form-control"></b>
<b>Point B : <input type="text" class="form-control"><b>
<button>Validate</button>
</form>
</div>
</div>
<div class="row">
<br></br>
</div>
<div class="row">
<div class="col-lg-4"></div>
<div class="col-lg-4">
<button type="button" class="btn btn-success sharp">Good</button>
<button type="button" class="btn btn-warning sharp">Normal</button>
<button type="button" class="btn btn-danger sharp">Bad</button>
</div>
<div class="col-lg-4"></div>
</div>
</div>
You should set the map height style, but not the width. Also you should set:
#map-container img {
max-width: none;
}
See this question on stackoverflow for more information.