Bootstrap buttons group not displayed properly in footer of a panel - html

I am using Bootstrap and can't find my problem where button groups in not aligned properly when inserten in right hand side of the panel footer.
My code id:
<div class="container">
<div class="col-md-6">
<div class="panel panel-primary">
<div class="panel-heading"><b>My Title</b><span class="pull-right">123</span></div>
<div class="panel-body">
Just a test text<br>
</div>
<div class="panel-footer">
Some information herre
<div class="btn-group pull-right">
<button type="button" class="btn btn-primary dropdown-toggle " data-toggle="dropdown">
Group of buttons <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><span class="glyphicon glyphicon-edit"></span> Edit </li>
<li><span class="glyphicon glyphicon-trash"></span> Delete</li>
<li class="divider"></li>
<li><span class="glyphicon glyphicon-list-alt"></span> PDF</li>
</ul>
</div>
</div>
</div>
</div>
</div><!-- /.container -->
To demonstrate a problem please take a look at working code:
http://jsfiddle.net/69r7s63w/

Actually the easiest and cleanest way is to add a clearfix class to your footer:
<div class="panel-footer clearfix">
Demo: http://jsfiddle.net/r819f85u/
You don't need to add any extra markup to archive this. If you have multiple instances like this, you can even override panel-footer to let take effect automatically, but you'd better use Less/Sass/... version, otherwise will be complicated to add an clearfix effect.
Below is an example by using Sass:
// Overriding must be written or imported after Bootstrap
.panel-footer {
#include clearfix;
}

If you use containers it will fit better within the footer.
<div class="row">
<div class="col-xs-6">
<p>
Some information herre
</p>
</div>
<div class="col-xs-6">
<!-- Single button -->
<div class="btn-group pull-right">
<button type="button" class="btn btn-primary dropdown-toggle " data-toggle="dropdown">Group of buttons <span class="caret"></span></button>
<ul class="dropdown-menu" role="menu">
<li><span class="glyphicon glyphicon-edit"></span> Edit </li>
<li><span class="glyphicon glyphicon-trash"></span> Delete</li>
<li class="divider"></li>
<li><span class="glyphicon glyphicon-list-alt"></span> PDF</li>
</ul>
</div>
</div>
</div>
Updated fiddle

You can also change the size of the button to btn-sm or btn-xs. Also I'm not entirely sure why but making the button float right causes it to not be able to stretch heights within a container, usually I see
<div class="clearfix"></div>
put at the end of float elements which will stretch the container.

You need to adjust line height of text Some information here, since it is not wrapped under any div or so..
Just change
Some information here to <span class="footer-text">Some information here</span> and then adjust the line height of .footer-text class using following CSS
.footer-text{
line-height:33px;
}
Fiddle here : http://jsfiddle.net/rahulrulez/69r7s63w/1/
Updated Solution with best practices
Change HTML to this :
<div class="container">
<div class="col-xs-6 footer-text">Some information herre</div>
<!-- Single button -->
<div class="col-xs-6 pull-right">
<button type="button" class="btn btn-primary dropdown-toggle " data-toggle="dropdown">
Group of buttons <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><span class="glyphicon glyphicon-edit"></span> Edit </li>
<li><span class="glyphicon glyphicon-trash"></span> Delete</li>
<li class="divider"></li>
<li><span class="glyphicon glyphicon-list-alt"></span> PDF</li>
</ul>
</div>
</div>
http://jsfiddle.net/rahulrulez/69r7s63w/3/

Related

How Do I Change This Bootstrap to work on Joomla the way I need?

I want to have this bootstrap menu I'm creating and will use for many shows on our website to be a plain nav-tabs menu with the Social and info links on the right side. But I can't figure out the code. I'm wondering if someone can help us with the code and change it so it uses the nav-tabs instead of the normal nav & looks clean instead of the gray block it's in currently...
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
</a>
<a class="brand" href="#">Name Of Show</a>
<div class="nav-collapse">
<ul class="nav">
<li>Cast</li>
<li>Episodes</li>
</ul>
</li>
</ul>
<ul class="nav pull-right">
<div class="btn-group">
<a class="btn btn-default" style="color:#3b5998;margin-top:-2px;" href="#">
<i class="fa fa-facebook fa-2x" title="Facebook"></i>
</a>
<a class="btn btn-default" style="color:#00aced;margin-top:-2px;" href="#">
<i class="fa fa-twitter fa-2x" title="Twitter"></i>
</a>
<button type="button" style="height:39px;margin-top:-2px;" class="btn btn-inverse">TV-14</button>
<button type="button" style="height:39px;margin-top:-2px;" class="btn btn-default disabled">1 Season | HD | 2011</button>
</div>
</ul>
</div><!-- /.nav-collapse -->
</div>
</div><!-- /navbar-inner -->
</div>
Thank you in advance to anyone who helps me with this. I've been stuck for days...
With Protostar Template (one of default templates in Joomla!) you could use the nav-tabs instead of nav-pills or others Bootstrap classes opening the administration panel > module > menu > advanced > Menu Class Suffix; and inside the field write simply nav-tabs after a space.
If you want substitute the entire HTML code of menu you have to build a new Joomla! module or try to modify the php files here: joomla root/modules/mod_menu/tmpl

Positioning drop down in panel heading boostrap

I'm trying to add drop down to panel header (bootstrap). I've aligned drop down to right but it's not positioning properly.
Code
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<i class="fa fa-bar-chart-o fa-fw"></i>
Analytics
</h3>
<div class="btn-group" style="float: right;">
<button class="btn">Action</button>
<button class="btn dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li>Item I</li>
<li>Item II</li>
<li>Item III</li>
<li class="divider"></li>
<li>Other</li>
</ul>
</div>
</div>
<div class="panel-body">
<div id="analytics-chart"></div>
</div>
</div>
</div>
</div>
What I would do in this situation is move the btn-group inside of the <h3> tag before applying the float:right; style (either using style="float:right;" or class="pull-right"). Then, simply adjust the top margin to something that makes it fit a little better into the panel-title, such as -8px:
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-bar-chart-o fa-fw"></i>
<div class="btn-group pull-right" style="margin-top:-8px;">
<button class="btn">Action</button>
<button class="btn dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right">
<li>Item I</li>
<li>Item II</li>
<li>Item III</li>
<li class="divider"></li>
<li>Other</li>
</ul>
</div>
Analytics
</h3>
</div>
<div class="panel-body">
<div id="analytics-chart"></div>
</div>
</div>
</div>
</div>
Also, remember to add dropdown-menu-right to your dropdown when using pull-right, otherwise it will extend beyond the edge of the screen.
Buttons never behave well when added to a panel-heading class, but you're free to tweak the classes to fit your needs.
Hope this helps!
Bootply Example

Creating a two column dropdown in angular-ui-bootstrap

I have about 13 items in my list, so I'd like to make my dropdown menu in ui-bootstrap have at least two columns. Right now, here is my html for the button:
<div class="btn-group" uib-dropdown keyboard-nav>
<button id="simple-btn-keyboard-nav" type="button" class="btn btn-primary" uib-dropdown-toggle>
Graph By Indications<span class="caret"></span>
</button>
<ul uib-dropdown-menu role="menu" aria-labelledby="simple-btn-keyboard-nav">
<li class="nav-item" ng-repeat="item in test2" ng-click="fullIndicationFunction(item)">{{item}}</li>
</ul>
<ul uib-dropdown-menu role="menu" aria-labelledby="simple-btn-keyboard-nav">
<li class="nav-item" ng-repeat="item in test1" ng-click="fullIndicationFunction(item)">{{item}}</li>
</ul>
</div>
Right now, I end up with separate columns on top of each other, and I'm trying to get them beside each other. I've tried the wrapping the <ul> tags with a <div class="row">...</div>, but that just stops the dropdown from working altogether.
Here is the what the above code produces:
Using one <ul> and having both the <li> elements within columns in a <row> will create the two column list I was looking for.
<div class="btn-group" uib-dropdown uib-keyboard-nav style="border-bottom: #357ebd 3px solid; border-radius: 10px">
<button class="btn btn-primary" ng-click="clearVals()">Clear</button>
<button type="button" class="btn btn-primary">
{{ displayedIndication }}
</button>
<button type="button" class="btn btn-primary" uib-dropdown-toggle>
<span class="caret"></span>
</button>
<ul uib-dropdown-menu role="menu" aria-labelledby="simple-btn-keyboard-nav" style="margin-right:-120px">
<div class="row" style="padding-left:7px; padding-right:7px">
<div class="col-sm-6" style="padding-left:-7px">
<li class="nav-item" ng-repeat="item in indList" ng-click="fullIndicationFunction(item)">{{item}}</li>
</div>
<div class="col-sm-6">
<li class="nav-item" ng-repeat="item in indList2" ng-click="fullIndicationFunction(item)">{{item}}</li>
</div>
</div>
</ul>
</div>
I used inline styles just to show that there are a bit of tweaks you'll need to make to have the lists look clean and even spaced without overlapping. Heres the result:

Why is the ng-repeat directive failing to populate list items on a bootstrap dropdown?

Trying to do something very simple here:
<div class="container">
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Select Player
<span class="caret"></span></button>
<ul ng-repeat="name in Ids" class="dropdown-menu">
<li>
<a href="#/{{name.Player_Id}}">
{{name.Player_First_Name}} {{name.Player_Last_Name}}
</a>
</li>
</ul>
</div>
</div>
I can't see why this isn't working: if I attempt to simply render an unordered list then the data is displayed correctly. But as soon as I try to include it in bootstrap's dropdown menu, the button is displayed but not expanded when clicked.
Why are you doing ng-repeat on the ul element, it should be li element, otherwise you're creating multiple lists.
<div class="container">
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Select Player
<span class="caret"></span></button>
<ul class="dropdown-menu">
<li ng-repeat="name in Ids">
<a href="#/{{name.Player_Id}}">
{{name.Player_First_Name}} {{name.Player_Last_Name}}
</a>
</li>
</ul>
</div>
</div>
Your code says to repeat the <ul> element, but don't you want to repeat the <li> elements? This should work:
<ul class="dropdown-menu">
<li ng-repeat"name in IDs">
<a href="#/{{name.Player_Id}}">
{{name.Player_First_Name}} {{name.Player_Last_Name}}
</a>
</li>
</ul>
If you still have problems, I'd suggest you confirm your module is using the ui.bootstrap components. There are working examples of the dropdowns doing exactly what you want here on the documentation page.

bootstrap dropdown submenu left align

I need to display the submenu to left align as right align making my layout messy. I'm using bootstrap.
<div class="btn-group">
<div class="dropdown">
<a href="#" data-toggle="dropdown" class="btn">
<i class="icon-folder-close"></i> <span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>Outbox</li>
<li>Trash</li>
</ul>
</div>
</div>
Bootstrap has the option to make drop downs positioned out to the right. You can see an example of this on the bootstrap navbar section.
If you add the class navbar-right to your btn-group you should find that the dropdown changes drop direction.
<div class="btn-group navbar-right">
<div class="dropdown">
<a href="#" data-toggle="dropdown" class="btn">
<i class="icon-folder-close"></i> <span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>Outbox</li>
<li>Trash</li>
</ul>
</div>
</div>
Here is a JSFiddle