Bootstrap 3 navigation dropdown stopped working - css

I haven't changed any code on prod and qa but for some reason my qa collapse nav has stopped working pasting both the code here since I can't figure out what's wrong, I checked the console for error if any but its showing nothing, i even compared both the codes and it shows all is fine.
PROD WORKING
<div class="collapse navbar-collapse navHeaderCollapse">
<ul class="nav navbar-nav navbar-right">
<li>Daily Experience</li>
<li>Attendance Records</li>
<li>Photos</li>
<li>School Info</li>
<li class="dropdown">
<a data-toggle="dropdown" style="padding-top: 21px; padding-bottom: 11px; !important" class="dropdown-toggle" href="#">History <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>Daily Experience</li>
<li>Attendance Records</li>
</ul>
</li>
<li>Profile</li>
<li class="dropdown">
<a data-toggle="dropdown" style="padding-top: 21px; padding-bottom: 11px; !important" class="dropdown-toggle" href="#">Select Child <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>Annett Joy</li>
<li>Charlotte Pinkiewicz</li>
</ul>
</li>
<li>Change Password</li>
<li>Logout</li>
</ul>
</div>
QA NOT WORKING
<div class="collapse navbar-collapse navHeaderCollapse">
<ul class="nav navbar-nav navbar-right">
<li>Daily Experience</li>
<li>Attendance Records</li>
<li>Photos</li>
<li>School Info</li>
<li class="dropdown">
<a data-toggle="dropdown" style="padding-top: 21px; padding-bottom: 11px; !important" class="dropdown-toggle" href="#">History <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>Daily Experience</li>
<li>Attendance Records</li>
</ul>
</li>
<li>Profile</li>
<li class="dropdown">
<a data-toggle="dropdown" style="padding-top: 21px; padding-bottom: 11px; !important" class="dropdown-toggle" href="#">Select Child <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>Annett Joy</li>
<li>Charlotte Pinkiewicz</li>
</ul>
</li>
<li>Change Password</li>
<li>Logout</li>
</ul>
</div>
This is a screenshot of my Network tab

Everything is just fine in your code but I'm sure that your jQuery library doesn't loaded correctly. Make sure that jQuery script is included on the page as well as it present on specified path. Then it will work fine.
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
Here is the demo of QA code after including jQuery reference.
JS Fiddle Demo

Bootstrap.js was getting loaded twice for some reason so i removed it once and it started working.

Related

ng-repeat only populates last entry in array when used with uib-dropdown

I'm trying to populate a drop down menu using UI Bootstrap's uib-dropdown and ng-repeat but only the last record in the array is being populated.
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li ng-class="{active: isActive('/resources/')}" class="dropdown" uib-dropdown>
<a uib-dropdown-toggle class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="true">Resources <span class="caret"></span></a>
<ul ng-repeat="resource in TN.resourceList" class="dropdown-menu">
<li>{{ resource.ResourceText }}</li>
</ul>
</li>
</ul>
</div>
I've confirmed that TN.resourceList has 3 records.
If I remove: class="dropdown-menu"
from: <ul ng-repeat="resource in TN.resourceList" class="dropdown-menu">
then all the records display but it no longer renders as a drop down menu.
I also tried adding the uib-dropdown-menu directive to the <ul> with the ng-repeat on it as well as the role attributes as suggested in this answer: Bootstrap Dropdownlist Issue in angular JS
But it had no effect.
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li ng-class="{active: isActive('/resources/')}" class="dropdown" uib-dropdown>
<a uib-dropdown-toggle class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="true">Resources <span class="caret"></span></a>
<ul class="dropdown-menu">
<li ng-repeat="resource in TN.resourceList">{{ resource.ResourceText }}</li>
</ul>
</li>
</ul>
</div>
Notice the ng-repeat on the li instead of the ul dom element (ng-repeat repeats elements where it added to and it's childeren).
You're repeating the dropdown-menu itself. You should have one dropdown-menu and repeat the li instead:
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li ng-class="{active: isActive('/resources/')}" class="dropdown" uib-dropdown>
<a uib-dropdown-toggle class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="true">Resources <span class="caret"></span></a>
<ul class="dropdown-menu">
<li ng-repeat="resource in TN.resourceList">{{ resource.ResourceText }}</li>
</ul>
</li>
</ul>
</div>
Easiest answer is to consider looking at the ng-repeat itself as a loop. Within normal html, you wouldn't want to have multiple lists or 'ul' tags would you? You would want one list with multiple entries or 'li' tags.
Consider the answers above as direct answers, but realistically, you should be able to look at your code and figure out that you want to repeat the list entries and not the list itself.

Three layer dropdowns

Would it be possible using css bootstrap to recreate this style of menu I am using bootstrap and so far I have the top bar just with the two tabs and drop downs. I also see to show a drop down as in the administrator link you see and also a settings cog.
The blue icons buttons shoud be drop downs till the last item. I have posted my initial code on pastbin as the editor here was turning them into elements. Can someone advise me on how to stop that from hapening.
Code
<div class="navbar-inner">
<div class="container-fluid">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li class="active"><i class="icon-home icon-white"></i> Home</li>
<li>Cassed Dimensions Portal</li>
<li>Configruation Items</li>
<li class="dropdown">
Products<b class="caret"></b>
<ul class="dropdown-menu">
<li>Latest Products</li>
<li>Popular Products</li>
</ul>
</li>
<li class="dropdown">
Membership<b class="caret"></b>
<ul class="dropdown-menu">
<li>Personal Membership</li>
<li>Premium Membership</li>
</ul>
</li>
<li>Offers</li>
<li>Gallery</li>
<li>About Us</li>
<li>Contact</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Dropdown <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>Right</li>
<li>Right</li>
</ul>
</div><!-- /.nav-collapse -->
</div><!-- /.container -->
</div><!-- /.navbar-inner -->
</div><!-- /.navbar -->

Twitter Bootstrap - center navbar when responsive to two rows

I have a navbar with a bunch of dropdowns. When the navbar is on one row (full size screen), I got it to be centered. When the screen size is small, I successfully made it collapse into a button, which is centered. However, when the screen size is medium and the navbar is on two rows, neither row is centered. How do I fix this?
Here is the jsFiddle: http://jsfiddle.net/grzt/US2sS/
You can resize the jsFiddle lower-right frame to see the different screen size results I mentioned above.
HTML:
<nav class="navbar navbar-inverse">
<div class="container-fluid" style="text-align: center;">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navigation-navbar-collapse" id="navigation-collapse-btn">
<div id="navigation-collapse-text">Navigation</div>
<span class="sr-only">Toggle navigation</span>
</button>
<div class="collapse navbar-collapse" id="navigation-navbar-collapse">
<ul class="nav navbar-nav">
<li class="dropdown">
Some Words <b class="caret"></b>
<ul class="dropdown-menu">
<li>Link</li>
</ul>
</li>
<li class="dropdown">
Some Words <b class="caret"></b>
<ul class="dropdown-menu">
<li>Link</li>
</ul>
</li>
<li class="dropdown">
Some Words <b class="caret"></b>
<ul class="dropdown-menu">
<li>Link</li>
</ul>
</li>
<li class="dropdown">
Some Words <b class="caret"></b>
<ul class="dropdown-menu">
<li>Link</li>
</ul>
</li>
<li class="dropdown">
Some Words <b class="caret"></b>
<ul class="dropdown-menu">
<li>Link</li>
</ul>
</li>
<li class="dropdown">
Some Words <b class="caret"></b>
<ul class="dropdown-menu">
<li>Link</li>
</ul>
</li>
<li class="dropdown">
Some Words <b class="caret"></b>
<ul class="dropdown-menu">
<li>Link</li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
CSS:
.navbar-nav {
/*center navbar inner elements*/
display: inline-block;
float: none;
}
.navbar-toggle
{
/*center collapse button*/
float:none;
}
If you want to keep menu in center avoid using float. Check if this helps you.
#media (min-width: 768px) {
.navbar-nav>li {
float: none;
display: inline-block;
}
}

Bootstrap 3 Fixed Nav - Hide/Resize Logo

Using the latest version Bootstrap, I am wanting to replace the branding area text with a logo. On my desktop, it looks perfect, on my iPhone, the logo appears under the small collapse menu, whereas it should be beside it (to the left of it). If I make the logo smaller, it works fine on the iPhone, but the small logo is too small for the desktop site. I thought by adding the img-responsive class to the logo, it would shrink accordingly, but that fails. If you want to replicate this, the logo is 276px wide 40px high.
Everything appears fine on the iPhone in horizontal orientation (it is strictly a problem when viewing in vertical, which is naturally the way most people hold their phone).
Here is the related code (you will notice near the bottom, there is a purchase button, this automatically gets hidden on the iPhone, which would suffice for the logo if there is no other option). Mind, the ultimate solution would be to have the logo shrink based on screen size.
<!-- Fixed navbar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.php"><img class="img-responsive" src="img/logo.png" alt=""></a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li class="dropdown">
Application <b class="caret"></b>
<ul class="dropdown-menu">
<li>Features</li>
<li>Screenshots</li>
<li>Demos</li>
<li class="divider"></li>
<li>Purchase</li>
<li>Licensing Model</li>
</ul>
</li>
<li class="dropdown">
Documentation <b class="caret"></b>
<ul class="dropdown-menu">
<li>Version Info</li>
<li>System Requirements</li>
<li class="divider"></li>
<li>Installation Guide</li>
<li>Integration Guide</li>
<li>Frontdesk Manual</li>
</ul>
</li>
<li class="dropdown">
Support <b class="caret"></b>
<ul class="dropdown-menu">
<li>Knowledgebase</li>
<li>Submit Ticket</li>
<li>View Ticket Status</li>
<li class="divider"></li>
<li>Installation Service</li>
<li>Development Services</li>
</ul>
</li>
<li class="dropdown">
Contact <b class="caret"></b>
<ul class="dropdown-menu">
<li>Presales Questions</li>
<li>Contact Us</li>
</ul>
</li>
<li class="dropdown">
Legal <b class="caret"></b>
<ul class="dropdown-menu">
<li>Privacy Policy</li>
<li>Terms of Use</li>
<li>Site Security</li>
<li class="divider"></li>
<li>Money Back Guarantee</li>
</ul>
</li>
</ul>
<button type="button" class="btn btn-success" style="margin-top: 8px; margin-left: 30px;">Purchase</button>
</div>
<!--/.nav-collapse -->
This fixes the I-phone issue with the brand logo appearing under the collapsed menu icon. you might have to play with the width a bit depending on your setup:
#media (max-width: 500px) {
.navbar-brand{
width:60%;
}
}
Put your image as a background in css with background-size:cover.

bootstrap error shows carot on dropdown navbar menu

I have a navbar dropdown that when highlighted, shows an extra caret. It occurs on each highlighted option in the navbar.
Here is my code:
<ul class="nav pull-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Username
<i class="caret"></i>
</a>
<ul class="dropdown-menu">
<li><i class="icon-home"></i> Dashboard</li>
<li><i class="icon-user"></i> Profile</li>
<li class="divider"></li>
<li>Logout</li>
</ul>
</li>
</ul>
Try this HTML, works fine for me (Google Chrome):
http://jsfiddle.net/CpQVb/

Resources