align 2 divs in bootstrap modal - css

I don't know if my Title is clear enough.
I try to explain myself with dome code
I have HTML Modal dialog like this
<div id="ModalGraficoCompLav_0" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class='modal-dialog'>
<div class='modal-content'>
<div class='modal-header'>
<button type=?button' class='close' data-dismiss='modal' aria-hidden='true'>×</button>
<h4 class='modal-title'>Stato Componenti e Lavorazioni</h4>
</div>
<div id='ModalBody' class='modal-body'>
<div class='row'>
<div class='col-lg-6'> Componenti
<div id='GraficoComp0'class='ModalGraficoSmall'></div>
</div>
<div class='col-lg-6'>Lavorazioni
<div id='GraficoLav0'class='ModalGraficoSmall'></div>
</div>
</div>
</div>
<div class='modal-footer'><button type='button' class='btn btn-default' data-dismiss='modal'>Chiudi</button>
</div>
</div>
</div>
</div>
the 2 divs col-lg-6 will be filled with jquery flot plugin.
In my css I have these rules:
.ModalGraficoSmall { width: 200px; height:100px;}
Setting width and height is mandatory for jquery flot, If I doesn't set width or height the chart won't appear anymore.
Now, for completeness I put also jquery flot scripts
var opts = {
series: {
pie: {
show: true,
radius: 1,
label: {
show: true,
radius: 2 / 3,
formatter: function (label, series) {
return '<div style="font-size:11px ;text-align:center; padding:2px; color:white;">' + label + '<br/>' + Math.round(series.percent) + '%</div>';
},
threshold: 0.1
}
}
},
legend :
{
show: false
}
};
$.plot($("#GraficoComp0"), dataComp, opts);
$.plot($("#GraficoLav0"), dataLav, opts);
this is my result:
what I would like to obtain is this:

Try this setup, in the modal I have 2 panels, just fill in the panel bodies with your chart!
Code:
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content"></div>
</div>
<div class="modal-dialog">
<div class="modal-content"></div>
</div>
<div class="modal-dialog">
<div class="modal-content"></div>
</div>
<div class="modal-dialog">
<div class="modal-content"></div>
</div>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span>
</button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading text-center">
<h3 class="panel-title">Chart One</h3>
</div>
<div class="panel-body"></div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading text-center">
<h3 class="panel-title">Chart Two</h3>
</div>
<div class="panel-body"></div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
<!-- Button trigger modal -->
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">Launch demo modal</button>
Read about the bootstrap grid system here

Related

Bootstrap 4 Modal styling (FlexBox) not working in IE

I am creating a confirm dialog using Bootstrap 4 and the code goes like this
<div class="modal fade show" id="completeAlertDialogue" role="dialog" style="display: block;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Confirm Navigation</h4>
</div>
<div class="modal-body">
<p>You haven't saved your changes. Are you sure you want to leave this page?</p>
</div>
<div class="modal-footer">
<div class="order-2"><button class="btn btn-sm btn-primary" type="button" data-dismiss="modal">Yes</button></div>
<div class="mr-auto order-1"><button class="btn btn-sm btn-outline-secondary" type="button" data-dismiss="modal">No</button></div>
<div class="clearfix"></div>
</div>
</div>
</div>
</div>
The styling is working fine in chrome, firefox, edge but not working in IE
Chrome
IE11
Created a fiddle for the same.
Try the following HTML structure for "modal-footer"
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<div class="modal fade show" id="completeAlertDialogue" role="dialog" style="display: block;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Confirm Navigation</h4>
</div>
<div class="modal-body">
<p>You haven't saved your changes. Are you sure you want to leave this page?</p>
</div>
<div class="modal-footer justify-content-start">
<button class="btn btn-sm btn-outline-secondary" type="button" data-dismiss="modal">No</button>
<button class="ml-auto btn btn-sm btn-primary" type="button" data-dismiss="modal">Yes</button>
</div>
</div>
</div>
</div>
display flex is not full support in IE.
i change footer display flex to block, then its work. check bellow code
<div class="modal fade show" id="completeAlertDialogue" role="dialog" style="display: block;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Confirm Navigation</h4>
</div>
<div class="modal-body">
<p>You haven't saved your changes. Are you sure you want to leave this page?</p>
</div>
<div class="modal-footer d-block">
<div class="row">
<div class="col-sm-6"><button class="btn btn-sm btn-primary" type="button" data-dismiss="modal">Yes</button></div>
<div class="col-sm-6 text-right"><button class="btn btn-sm btn-outline-secondary" type="button" data-dismiss="modal">No</button></div>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
</div>

Making bootstrap modal work in a framework7 web app

I am having trouble with including bootstrap modal onto a framework7 app.
I suspect that framework7 is suppressing boostrap modal from appearing.
This is my fiddle.
<div class="navbar">
<div class="navbar-inner">
<div class="left sliding"><i class="icon icon-back"></i><span>Back</span></div>
<div class="">
<span id="project_name" class="center sliding">Title</span>
</div>
<div class="right">
<a id="create_task" style="">Create</a>
</div>
</div>
</div>
<div class="pages navbar-through ">
<div data-page="about" class="page no-toolbar page-on-center">
<div class="page-content">
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>
<div class="content-block">
<p>This project is made possible because of these open-source projects & beta testers.</p>
</div>
<div class="content-block-title">Open Source</div>
<div class="content-block">
<div class="content-block-inner">
Framework7
</div>
<div class="content-block-inner">
Vuejs
</div>
<div class="content-block-inner">
Ruby on Rails
</div>
<div class="content-block-inner">
Font Awesome
</div>
<div class="content-block-inner">
Axios
</div>
<div class="content-block-inner">
Kaminari
</div>
<div class="content-block-inner">
Puma
</div>
</div>
<div class="content-block-title">Thanks to these beta testers</div>
<div class="content-block">
<div class="content-block-inner">
<li>John Doe</li>
<li>Nathan</li>
<li>Sharon days</li>
</div>
</div>
<div class="content-block-title">Logo</div>
<div class="content-block">
<div class="content-block-inner">
<b>Lau Jun Wen</b>
</div>
</div>
<!-- Trigger the modal with a button -->
<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
<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>
</div>
</div>
</div>
Can someone give me some pointers on what is wrong? There is no error message. Appreciate any feedback/advice to resolve this.
I have made several changes to correct the problems:
Removed the modal.min.js. This was the problem causing the modal to open and close again.
Re-ordered the bootstrap/framework7 CSS + JS to put framework7 after the bootstrap (so that the framework7 overrides bootstrap when necessary).
Put the myModal div at the end of the code so that its z-index does not get blocked by a parent div's less-high z-index.
Add some custom CSS to make the modal show up correctly. This is necessary due to using two frameworks.
Here is the final code:
#myModal.modal {
width: auto;
margin-left: 0;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1050;
display: none;
overflow: hidden;
-webkit-transform: translate3d(0,0,0) scale(1);
transform: translate3d(0,0,0) scale(1);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/js/bootstrap.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/framework7/1.6.4/js/framework7.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/framework7/1.6.4/css/framework7.ios.min.css" rel="stylesheet"/>
<div class="navbar">
<div class="navbar-inner">
<div class="left sliding"><i class="icon icon-back"></i><span>Back</span></div>
<div class="">
<span id="project_name" class="center sliding">Title</span>
</div>
<div class="right">
<a id="create_task" style="">Create</a>
</div>
</div>
</div>
<div class="pages navbar-through ">
<div data-page="about" class="page no-toolbar page-on-center">
<div class="page-content">
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>
<div class="content-block">
<p>This project is made possible because of these open-source projects & beta testers.</p>
</div>
<div class="content-block-title">Open Source</div>
<div class="content-block">
<div class="content-block-inner">
Framework7
</div>
<div class="content-block-inner">
Vuejs
</div>
<div class="content-block-inner">
Ruby on Rails
</div>
<div class="content-block-inner">
Font Awesome
</div>
<div class="content-block-inner">
Axios
</div>
<div class="content-block-inner">
Kaminari
</div>
<div class="content-block-inner">
Puma
</div>
</div>
<div class="content-block-title">Thanks to these beta testers</div>
<div class="content-block">
<div class="content-block-inner">
<li>John Doe</li>
<li>Nathan</li>
<li>Sharon days</li>
</div>
</div>
<div class="content-block-title">Logo</div>
<div class="content-block">
<div class="content-block-inner">
<b>Lau Jun Wen</b>
</div>
</div>
</div>
</div>
</div>
<!-- Trigger the modal with a button -->
<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
<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>
Updated fiddle here

Bootstrap Modals - Modal id's different yet only one appears correctly

I'm having trouble with these modals in bootstrap. I have set the id for both differently yet only the first one appears when the "more" button is pressed. The second button does not show the required modal.
<div id="tf-team" class="text-center">
<div class="overlay" id="team1">
<div class="container">
<div class="section-title center">
<h4>Something</h4>
<h2 class="white">The Team</h2>
<img src="img/daag.png" alt="">
</div>
</div>
<div id="team" class="owl-carousel owl-theme row">
<!-- Team One -->
<div class="item">
<div class="thumbnail">
<img src="img/team/01.jpg" alt="..." class="img-circle team-img">
<div class="caption">
<h3>CEO name</h3>
<p class="blue">CEO</p>
<button class="btn btn-primary" data-toggle="modal" data-target="#myModal1">More</button>
</div>
</div>
</div>
<!-- Team Two -->
<div class="item">
<div class="thumbnail">
<img src="img/team/03.jpg" alt="..." class="img-circle team-img">
<div class="caption">
<h3>Marketing Executive name</h3>
<p class="blue">Marketing Executive</p>
<button class="btn btn-primary" data-toggle="modal" data-target="#myModal2">More</button>
</div>
</div>
</div>
These are the modals that should be appearing. The first modal appears as normal but the second doesn't even though the ID's are different.
<!-- Modal One-->
<div id="myModal1" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">text</h4>
</div>
<div class="modal-body">
<p><strong>text</strong></p>
<p>text</p>
<p><strong>text</strong></p>
<p>text
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
<!-- Modal Two-->
<div id="myModal2" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Dana</h4>
</div>
<div class="modal-body">
<p><strong>text</strong></p>
<p>text
</p>
<p><strong>text Tick</strong></p>
<p>text
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
Does anyone have any ideas as to why this is happening?
You are just missing two closing </div> tags on the first modal.
<script src="https://code.jquery.com/jquery.min.js"></script>
<link href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" type="text/css" />
<script src="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<div id="tf-team" class="text-center">
<div class="overlay" id="team1">
<div class="container">
<div class="section-title center">
<h4>Something</h4>
<h2 class="white">The Team</h2>
<img src="img/daag.png" alt="">
</div>
</div>
<div id="team" class="owl-carousel owl-theme row">
<!-- Team One -->
<div class="item">
<div class="thumbnail">
<img src="img/team/01.jpg" alt="..." class="img-circle team-img">
<div class="caption">
<h3>Jim Rae</h3>
<p class="blue">CEO</p>
<button class="btn btn-primary" data-toggle="modal" data-target="#myModal1">More</button>
</div>
</div>
</div>
<!-- Team Two -->
<div class="item">
<div class="thumbnail">
<img src="img/team/03.jpg" alt="..." class="img-circle team-img">
<div class="caption">
<h3>Dana Apatachioae</h3>
<p class="blue">Marketing Executive</p>
<button class="btn btn-primary" data-toggle="modal" data-target="#myModal2">More</button>
</div>
</div>
</div>
<!-- Modal One-->
<div id="myModal1" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">text</h4>
</div>
<div class="modal-body">
<p><strong>text</strong>
</p>
<p>text</p>
<p><strong>text</strong>
</p>
<p>text
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
<!-- You are missing these two ending </div> tags. -->
</div>
</div>
<!-- Modal Two-->
<div id="myModal2" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Dana</h4>
</div>
<div class="modal-body">
<p><strong>text</strong>
</p>
<p>text
</p>
<p><strong>text Tick</strong>
</p>
<p>text
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>

Open modal popup on another modal popup

I want to show a modal on another modal while its still visible.
I am unable to understand what should I do. I tried z-index but its not working for me.
Any kind of guidance is much appreciated.
Check it out this
http://getbootstrap.com/javascript/#modals-examples
<div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="gridSystemModalLabel">
<div class="modal-dialog" 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="gridSystemModalLabel">Modal title</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-4">.col-md-4</div>
<div class="col-md-4 col-md-offset-4">.col-md-4 .col-md-offset-4</div>
</div>
<div class="row">
<div class="col-md-3 col-md-offset-3">.col-md-3 .col-md-offset-3</div>
<div class="col-md-2 col-md-offset-4">.col-md-2 .col-md-offset-4</div>
</div>
<div class="row">
<div class="col-md-6 col-md-offset-3">.col-md-6 .col-md-offset-3</div>
</div>
<div class="row">
<div class="col-sm-9">
Level 1: .col-sm-9
<div class="row">
<div class="col-xs-8 col-sm-6">
Level 2: .col-xs-8 .col-sm-6
</div>
<div class="col-xs-4 col-sm-6">
Level 2: .col-xs-4 .col-sm-6
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
$(#id_name).modal("toggle") <-- popup
$(#id_name).modal("hide") turn off
try this
Data-dismiss: used for closing modal.
Data-toggle:used for popup modal.
<a data-dismiss="modal" data-toggle="modal" href="#ModalId">Click</a>
OR
you can use onclicke method.
<a id="ID" data-dismiss="modal" data-toggle="modal" onclick="functionShowModal()">Click</a>
Jscript
functionShowModal()
{
$("#ID").load("#ModalId");
}
You have to define z-index for them accordingly as well. You will find more about z-index here

Html Agilitypack Getting Outer Items

i need to get <div class="month">May 2015</div> and <div class="author">Alex Xander</div> by id="duyuru3483". How can i reach upper divs (XPATH code):
<div class="item">
<div class="dateBox">
<div class="month">May 2015</div>
<div class="day">07</div>
</div>
<div class="mainInfo">
<div class="title">
<a href="#" class="text-justify" data-toggle="modal" data-target="#duyuru3483">
2014-2015 Yılı Mezuniyet Töreni Hk.
</a>
<div class="modal fade" id="duyuru3483" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header" style="background-color: #009E49;">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="myModalLabel">
<div class="duyuruBaslik">2014-2015 Yılı Mezuniyet Töreni Hk.</div>
</h4>
</div>
<div class="modal-body">
<div class="duyuruMetni"> Mezuniyet törenine katılmak için yapılmasıgereken işlemler ve doldurulması gereken form ektedir. </div>
<hr>
<div class="author" > Ek : <a style="color:##428bca" href="../files/19_mezuniyet.rar">indir</a> </div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Kapat</button>
</div>
</div>
</div>
</div>
</div>
<div class="author">Alex Xander</div>
One option is to use Ancestors:
var modal = doc.GetElementbyId("duyuru3483");
var parent = modal.Ancestors()
.Single(e => e.Attributes["class"] !=null &&
e.Attributes["class"].Value == "item");
Another option is to use XPath:
var parent = doc.DocumentNode
.SelectSingleNode("div[#class='item'][//div[#id='duyuru3483']]");
(you can algo get directly to .dateBox using:
div[#class='item'][//div[#id='duyuru3483']]/div[#class='dateBox']
And, of course, you can just use ParentNode, but that is less robust:
var parent = modal.ParentNode.ParentNode.ParentNode;
All of these get you to .item - it should be easy getting the data from there.

Resources