Bootstrap collapsed menu spacing issue with iphone - css

I'm using bootstrap navigation, and it's working perfectly when collapsed in android and chrome.
But when I tested it on an iPhone the dropdown list appears much lower in the screen, and I don't know what's causing this spacing.
the dropdown list also always appears behind other items like photos or sliders with iphone (works perfectly in android).
<header>
<div class="header-container">
<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="#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 class="tbc-logo" src="/NewDesign/img/tbc-logo.png">
</a>
</div>
<div id="language">
عربي
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<!--NAVIGATION -->
<ul class="nav navbar-nav ">
<li>Home <span class="sr-only">(current)</span></li>
<li class="dropdown">
About Us <span class="caret"></span>
<ul class="dropdown-menu">
<li>About TBC </li>
<li>Projects</li>
</ul>
</li>
<li class="dropdown">
Our Programs <span class="caret"></span>
<ul class="dropdown-menu">
<li>Private Schools</li>
<!-- <li role="separator" class="divider"></li>-->
<li>Investment </li>
</ul>
</li>
<li>Prequalification <span class="sr-only">(current)</span></li>
<li class="dropdown">
Careers <span class="caret"></span>
<ul class="dropdown-menu">
<li> Vacancies</li>
<li> COOP Training</li>
</ul>
</li>
<li class="dropdown">
Media files <span class="caret"></span>
<ul class="dropdown-menu">
<li>News</li>
<li>Photos</li>
<li>Library </li>
</ul>
</li>
<li>Contact Us <span class="sr-only">(current)</span></li>
</ul>
<!--END NAVBAR-->
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
</div>
</header>
I'm facing the same issue with chrome in iphone as well..

Related

Change CSS Styles BurguerMenu NavBar

I have a Bootstrap Navbar and I want that when I click on deploy button, this CSS (of the button) changes (I do not like CSS Button default). So... I want next:
When I click on Menu (in Xtra Small Sizes -as movile-) its CSS Styles change (eg: background-color: red).
How could I do this? What is his ClassNameCss? (eg: .navbar button[aria-expanded=true]) Thank you.
EDIT: Added my NavBar Code:
<nav class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle navbar-collapse-left" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Menú</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
{/*<a class="navbar-brand" href="/inicio"><img id="idFotoLogotipo" width="200px" src="./assets/images/cabecera_CE.jpg"/></a>*/}
<a class="navbar-brand visible-xs-block" /*href="http://www.upct.es/"*/><span id="idTextoLogotipo">- INCIDENCIAS -</span></a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-left">
<MenuNavItem to='/administrador/inicio' index={true} /*menuItemActive="inicio"*/>Inicio</MenuNavItem>
<MenuNavItem to='/administrador/nueva_incidencia' /*menuItemActive="nueva_incidencia"*/>Nueva Incidencia</MenuNavItem>
<MenuNavItem to='/administrador/incidencias_recibidas' /*menuItemActive="incidencias_recibidas"*/>Incidencias Recibidas</MenuNavItem>
<MenuNavItem to='/administrador/informes' /*menuItemActive="informes"*/>Informes</MenuNavItem>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="divider visible-xs-block"></li>
{this.state.logged === true ? <p class="nav navbar-text hidden-xs"><span class="glyphicon glyphicon-user"></span> Bienvenido, {this.state.nombre} ({this.state.dni})</p> : ''}
{this.state.logged === true ? <p class="nav navbar-text visible-xs-block"><span class="glyphicon glyphicon-user"></span> Bienvenido, {this.state.nombre}</p> : ''}
{this.state.logged === true ? <li class="salir"><span class="glyphicon glyphicon-off"></span> Salir</li> : <li class="entrar"><span class="glyphicon glyphicon-user"></span> Entrar</li>}
</ul>
</div>
</nav>
If you mean the 'burger menu' (three lines) dropdown toggle button shown here:
Then you should be able to target this with:
.navbar-toggle[aria-expanded="true"],
.navbar-toggle[aria-expanded="true"]:focus {
background-color: red;
}
Note that the :focus style is required as otherwise the default grey background colour will still show when the button is clicked, as at that point the button will have focus.
EDIT: try this example - I've since prefixed the styles with .navbar-default, which should ensure the styles work.
.navbar-default .navbar-toggle[aria-expanded="true"],
.navbar-default .navbar-toggle[aria-expanded="true"]:focus {
background-color: red;
}
.navbar-default .navbar-collapse[aria-expanded="true"] {
background-color: #428bca;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<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="#">Brand</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active">Link <span class="sr-only">(current)</span></li>
<li>Link</li>
<li class="dropdown">
Dropdown <span class="caret"></span>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li role="separator" class="divider"></li>
<li>Separated link</li>
<li role="separator" class="divider"></li>
<li>One more separated link</li>
</ul>
</li>
</ul>
<form class="navbar-form navbar-left">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
<ul class="nav navbar-nav navbar-right">
<li>Link</li>
<li class="dropdown">
Dropdown <span class="caret"></span>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li role="separator" class="divider"></li>
<li>Separated link</li>
</ul>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>

Bootstrap navbar toggle button not firing and menu not hidden

I have a bootstrap navbar that the toggle button doesnt close anything except my dropdown links, and my menu is not hidden. The menu was hidden prior to me implementing the toggle button.
<nav class="navbar navbar-default navbar-fixed-top navbar-header-full">
<div class="header-full-title img-responsive">
<img src="~/Content/img/MTC_logo_header.png" class="img-responsive" />
</div>
<div id="navbar" class="navbar-collapse">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle=".navbar-collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<ul class=" nav navbar-nav navbar-right">
<li>OUR STORY</li>
<li>VISIT</li>
<li>DIRECTORY</li>
<li>CONDOS</li>
<li>APARTMENTS</li>
<li class="dropdown">
EVENTS
<ul class="dropdown-menu dropDownMTC pull-right">
<li>YOGA ROCKS THE PARK</li>
<li role="separator" class="divider"></li>
<li>MONDAY NIGHT MOVIES</li>
<li role="separator" class="divider"></li>
<li>HORSES OF HONOR</li>
<li role="separator" class="divider"></li>
<li>THURSDAY IN THE PARK</li>
<li role="separator" class="divider"></li>
<li>EVENT SHUTTLE</li>
<li role="separator" class="divider"></li>
<li>HOLIDAY LIGHTS FESTIVAL </li>
</ul>
</li>
<li>NEWS</li>
</ul>
</div>
</div>
</nav>
You have the navbar-header inside the navbar-collapse. These should be two, completely separate divs if you go by the default. See Navbar
Working example Snippet.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" 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/25x25" />
</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class=" nav navbar-nav navbar-right">
<li>OUR STORY
</li>
<li>VISIT
</li>
<li>DIRECTORY
</li>
<li>CONDOS
</li>
<li>APARTMENTS
</li>
<li class="dropdown">
EVENTS
<ul class="dropdown-menu dropDownMTC pull-right">
<li>YOGA ROCKS THE PARK
</li>
<li role="separator" class="divider"></li>
<li>MONDAY NIGHT MOVIES
</li>
<li role="separator" class="divider"></li>
<li>HORSES OF HONOR
</li>
<li role="separator" class="divider"></li>
<li>THURSDAY IN THE PARK
</li>
<li role="separator" class="divider"></li>
<li>EVENT SHUTTLE
</li>
<li role="separator" class="divider"></li>
<li>HOLIDAY LIGHTS FESTIVAL
</li>
</ul>
</li>
<li>NEWS
</li>
</ul>
</div>
</div>
</nav>

Bootstrap default navbar is not collapsed in mobile view

So I am new to bootstrap and can't seem to find a solution to fix my problem which is when the mobile view the menu is open when I want it to be collapsed by default.
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<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="navbar-collapse collpase">
<ul class="nav navbar-nav navbar-left">
<li>Home</li>
<li>News & Events</li>
<li class="dropdown">
Things to do<b class="caret"></b>
<ul class="dropdown-menu">
<li>Leisure</li>
<li>Groups & Activities </li>
<li></li>
</ul>
</li>
<li class="dropdown">
Services<b class="caret"></b>
<ul class="dropdown-menu">
<li>Education & Learning</li>
<li>Personal Care</li>
<li>Police</li>
<li></li>
</ul>
</li>
<li>Businesses</li>
<li>History</li>
<li>Discussion Forum</li>
</ul>
</div>
</div>
</div>
Example screenshot
Typo in code
<div class="navbar-collapse collpase">
check spelling for collapse
You have the wrong class in the wrapping <div> of the dropdown, should be as follows (there's a typo in yours - "collpase"):
<div class="collapse navbar-collapse">
https://jsfiddle.net/2y9edmk1/
It's a JQuery issue.Check wether the JQuery is included correctly or not.

bootstrap 3.1.1 navbar wont collapse on phone

I have the following code. on phone, the navbar wont collapse after expanding, I have to click the button for it to toggle the style. any Idea?
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<a ui-sref="default" class="navbar-brand"></a>
<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="collapse navbar-collapse" id="navbar-main">
<ul class="nav navbar-nav">
<li ng-repeat="top in topnav" ng-class="{active: isActive(top.view), dropdown:top.subnav.length>=0}">
<a ui-sref="{{top.state}}" ng-show="top.subnav.length==0">{{top.name}}</a>
{{top.name}} <b class="caret"></b>
<ul class="dropdown-menu" ng-show="top.subnav.length > 0">
<li ng-repeat="sub in top.subnav">
<a ui-sref="{{sub.state}}">{{sub.name}}</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
Working Fiddle
Just use this;
<div class="navbar navbar-inverse">
<div class="container">
<div class="navbar-header">
<button data-target=".navbar-collapse" data-toggle="collapse" class="navbar-toggle" type="button">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
Project name
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li>About</li>
<li>Contact</li>
<li class="dropdown">
<a data-toggle="dropdown" class="dropdown-toggle" href="#">Dropdown <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li class="divider"></li>
<li class="dropdown-header">Nav header</li>
<li>Separated link</li>
<li>One more separated link</li>
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
did u include bootstrap.min.js?
Its required for drop down and collapse menu.
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>

Restoring expanded responsive navbar sub-menu creates scrollbar Bootstrap 3.0.2

I know this issue was covered in another post but his fix didn't work for me since I have a drop down sub-menu. Is there away just to make the menu collapse when switching between the two so the scroll bars don't appear?
Submenu css used
[http://bootsnipp.com/snippets/featured/multi-level-dropdown-menu-bs3][1]
Fixed Tired
This is a known issue in 3.0.2
(https://github.com/twbs/bootstrap/issues/11243)
A workaround:
.navbar-collapse.in {
overflow-y: visible; } Demo: http://bootply.com/96924
Skelly
Restoring expanded responsive navbar menu creates scrollbar in Bootstrap 3.0.2
My CSS Menu
<nav class="navbar navbar-fixed-top navbar-inverse" role="navigation">
<div class="container">
<div class="navbar-header" >
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<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="index.php">Chesapeake Controls Inc.</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div style="display: inline-block;" class="pull-right">
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<li class="dropdown">
Capabilities<b class="caret"></b>
<ul class="dropdown-menu">
<li class="dropdown-submenu">Building Automation Systems
<ul class="dropdown-menu">
<li>Products </li>
<li>Services </li>
</ul>
</li>
<li class="dropdown-submenu">HVAC Service
<ul class="dropdown-menu">
<li>Maintenance </li>
<li>Installation </li>
</ul>
</li>
</ul>
</li>
<li class="dropdown">
Projects<b class="caret"></b>
<ul class="dropdown-menu">
<li>Building Automation</li>
<li>HVAC</li>
</ul>
</li>
<li>Careers</li>
<li>Contact Us</li>
<li class="dropdown">
Login<b class="caret"></b>
<ul class="dropdown-menu">
<li>Customer Portal</li>
<li>PPS Maintenance</li>
<li class="divider"></li>
<li>File Server</li>
</ul>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container -->
</div>
</nav>

Resources