I have a bootstrap collapsible navigation component that, when collapsed, will show the collapsed icon, but when the icon is clicked, will not display the navigation links. Can anyone explain to me why this could be happening?
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#dropdown-nav" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="small-logo">
<img src="../assets/images/logo_small.png" alt="Logo" />
</div>
</div>
<div class="collapse navbar-collapse" id="dropdown-nav">
<ul class="nav navbar-nav" id="nav-left">
<li class="nav-link dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<i class="glyphicon glyphicon-dashboard"></i>
<span>Dashboards</span>
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li class="dropdown-link active" id="dashboard" (click)="handleNavigation($event)">
<i class="glyphicon glyphicon-facetime-video"></i>Fundus Exams
</li>
<li class="dropdown-link" id="exams" (click)="handleNavigation($event)">
<i class="glyphicon glyphicon-camera"></i>Exams
</li>
</ul>
</li>
<li class="nav-link dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<i class="glyphicon glyphicon-list-alt"></i>
<span>Reporting</span>
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li class="dropdown-link active" id="results" (click)="handleNavigation($event)">
<i class="glyphicon glyphicon-folder-open"></i>Results
</li>
<li class="dropdown-link" id="report" (click)="handleNavigation($event)">
<i class="glyphicon glyphicon-tasks"></i>Result Report
</li>
</ul>
</li>
</ul>
</div>
</nav>
While the browser window is full sized, the navigation works the way it's supposed to, but doesn't when it's collapsed.
I would like to mention, I am using Angular 2/4 and Bootstrap 3 to develop this application. Could that possibly be what the problem is?
To fix this issue, the only thing I did was, in the TypeScript, added a method which toggles the element when the button is clicked.
showHide(){
$("#dropdown-nav").toggle()
}
<button type="button" class="navbar-toggle collapsed" (click)="showHide()">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
Related
I'm building a responsive navigation using the DDRMenu Module in DNN.
The menu I am working on has 3 levels.
You can see it on http://lumenis.bondtest.nl/test-inner-menu
The mobile version (resolution below 770px) is styled differently ofcourse.
It's not working on hover but on click.
Now I want to have only 1 third menu open at the time. Now you can open all the menu at the same time which makes a really long list.
See:
This is my code:
<nav class="navbar navbar-default lumenisInnerMenu">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse lumenisListItems" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
[*>NODE]
</ul>
</div>
</div>
</nav>
[>NODE]
<li class="[?SELECTED]dir current[/?][?NODE]HasChildren child[=DEPTH] dropdownmenu [/?]">
[?ENABLED]
<a [?!NODE] href="[=URL]" [/?] [?TARGET]target="[=TARGET]"[/?] class="[?NODE]dropdown-toggle[/?]" data-toggle="collapse" data-target="#[=ID]">
<div class="textsubitem">
<span>[=TEXT]</span>
</div>
</a>
[?ELSE]
<a href="#" [?NODE] [/?]> [?NODE]
<span>[=TEXT]</span>[/?]
</a>
[/?]
[?NODE]
<ul class="dropdown-menu dropdown[=DEPTH]" id="[=ID]">
[*>NODE]
</ul>
[/?]
</li>
[/>]
How to solve?
Thanks in advance.
I'm working with the DDR Menu of DotNetNuke. I'm using it on this page:
http://lumenis.bondtest.nl/Aesthetic
The menu on the bottom is the ddr menu.
For some reason, the dropdown menu is not getting between the li's, but on top of them.
I'm using this code:
<nav class="navbar navbar-default lumenisInnerMenu">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse lumenisListItems" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
[*>NODE]
</ul>
</div>
</div>
</nav>
[>NODE]
<li class="[?SELECTED]dir current[/?][?NODE]HasChildren dropdownmenu [/?]">
[?ENABLED]
<a [?!NODE] href="[=URL]" [/?] [?TARGET]target="[=TARGET]"[/?] class="[?NODE]dropdown-toggle[/?]" data-toggle="collapse" data-target="#[=ID]">
<span>[=TEXT]</span>
</a>
[?ELSE]
<a href="#" [?NODE] [/?]> [?NODE]
<span>[=TEXT]</span>[/?]
</a>
[/?]
[?NODE]
<ul class="dropdown-menu dropdown[=DEPTH]" id="[=ID]">
[*>NODE]
</ul>
[/?]
</li>
[/>]
Does anybody have any idea what I'm doing wrong?
Thanks in advance.
I have a div that does not collapse in mobile view (always visible), but it is causing issues on larger displays when collapsible-links are present (as shown below).
Is there a way to make the collapsible links appear to the left of dynamic (userInfo) div? Trying to find a css solution, so angular/javascript would be the last resort.
Examples of desired effect:
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href=""><img src="http://placehold.it/599x255&text=Logo"></a>
<h4 class="navbar-text" id="navbarTitle">This is my navbar title</h4>
<ul class="nav" id="userInfo"> <!-- Dynamic -->
<li class="dropdown pull-right">
<a href="#" data-toggle="dropdown" class="dropdown-toggle">
<span class="glyphicon glyphicon-user icon-right"></span><b>{{empName}}</b>
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><span class="glyphicon glyphicon-log-out icon-right"></span>Logout </li>
</ul>
</li>
</ul>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<span class="glyphicon glyphicon-log-out icon-right"> Dropdown<span class="caret"></span>
<ul class="dropdown-menu">
<li>Action</li>
</ul>
</li>
<!--<li><span class="glyphicon glyphicon-log-out icon-right"></span>Logout</li>-->
</ul>
</div>
Plnkr Demo || JSFiddle Demo
Edit (End-result rephrasing):
I would like the links inside the div with class 'nav navbar-nav navbar-right' to always be left of the div with id 'userInfo'.
I am using Bootswatch Cosmo to build my website, but the dropdown menu isn't
working. You can view the page live at http://spencermehta.co.uk.
The html is:
<nav 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="#navigationbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../">Spencer Mehta</a>
</div>
<div class="collapse navbar-collapse" id="navigationbar">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Projects
<span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li>Spenbot</li>
</ul>
</li>
<li>Contact</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="http://twitter.com/spencermehta" target=_blank>Twitter</a></li>
<li><a href="http://twitch.tv/spencermehta" target=_blank>Twitch</a></li>
<li><a href="http://imraising.com/spencermehta" target=_blank>Donate</a></li>
</ul>
</div>
</div>
</nav>
Make sure that you have added jquery and bootstrap.js files and that their paths are correct.
I'm trying to make a menu for smartphones & tablets, but when I create it, it always overflows the content of my website.
The effect I want to achieve is the same as the Twitter Bootstrap website — When you open it with smartphones, you can press the button and the menu rolls down and pulls the content of the website.
Here is my code:
<div class="dropdown">
<button class="navbar-toggle hidden-lg collapsed" data-toggle="dropdown" data-target="navbar-header" type="button">
<span class="glyphicon glyphicon-collapse-down">
</span>
</button>
<div class="col-xs-12 dropdown-menu navbar-inverse" role="menu">
<a class ="divider" href="#">Accueil</a><br />
<a class ="divider" href="#">Centres d'Interets</a><br />
<a class ="divider" href="#">CV</a><br />
<a class ="divider" href="#">Contact</a><br />
</div>
</div>
You can use the example from the documentation as a start:
<nav class="navbar navbar-default" role="navigation">
<div class="container">
...
</div>
</nav>
You can find it here.
Try the below code. Courtesy: http://bootswatch.com Adjust the menu according to your requirements
<div class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
Bootswatch
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#navbar-main">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse" id="navbar-main">
<ul class="nav navbar-nav">
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" id="themes">Themes <span class="caret"></span></a>
<ul class="dropdown-menu" aria-labelledby="themes">
<li>Default</li>
<li class="divider"></li>
</ul>
</li>
<li>
Help
</li>
<li>
Blog
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" id="download">Download <span class="caret"></span></a>
<ul class="dropdown-menu" aria-labelledby="download">
<li>bootstrap.min.css</li>
<li>bootstrap.css</li>
<li class="divider"></li>
<li>variables.less</li>
<li>bootswatch.less</li>
<li class="divider"></li>
<li>_variables.scss</li>
<li>_bootswatch.scss</li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>Built With Bootstrap</li>
<li>WrapBootstrap</li>
</ul>
</div>
</div>
</div>
In the above code,
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#navbar-main">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
Gives the desired effect when the window size changes in browser or on small screens (Mobiles and tabs).