Bootstrap 3 off-canvas how to - html

So i just don't get it.
I've looked for some good examples for off canvas in bootstrap 3 but i just don't get it. I have already set up my navigation but dun know how this off canvas works.
When i use a mobile device i want my toggled navigation to slide in from the right to the left over the whole browser screen with an "X" on the upper left corner to close this one again. So it's like : User clicks on the toggled Navigation -> Navigtion slides in from the right to the left over the whole screen -> Navigation is listed there -> click on an menu point and close the navigation with sliding out from left to right.
Anyone got any ideas ???? Really need help
My Navigation looks like this atm :
<header>
<div class="container-header hidden-xs">
<!-- Navigation -->
<div class="first-nav">
<form class="navbar-search">
<input type="text" class="search-query span3" placeholder="search">
</form>
<ul class="social-buttons" id="home">
<li><i class="fa fa-youtube fa-lg"></i></li>
<li><i class="fa fa-twitter fa-lg"></i></li>
<li><i class="fa fa-xing fa-lg"></i></li>
<li><i class="fa fa-rss fa-lg"></i></li>
</ul>
<a class="navbar-lang" href="#" title="English">Eng</a>
</div>
</div>
<div id="nav">
<div class="navbar navbar-default navbar-static" role="navigation">
<div class="second-nav">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<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 class="nav-logo">
<img src="images/Logo_nav.png" alt="DnD">
</div>
<div class="navbar-collapse collapse">
<ul class="mainnav nav navbar-nav">
<li>Home</li>
<li>Leistungen</li>
<li>Über uns</li>
<li>Team</li>
<li class="dropdown">
Aktuelles<b class="caret"></b>
<ul class="dropdown-menu">
<li>Alle Artikel</li>
</ul>
</li>
<li>Kunden</li>
<li class="dropdown">
Jobs<b class="caret"></b>
<ul class="dropdown-menu">
<li>Alle Jobs</li>
</ul>
</li>
<li>Kontakt</li>
</ul>
</div>
</div>
</div>
</div>
</header>

Correct me if I am wrong, but something like below should work:
#media screen and (max-width: 767px) {
.row-offcanvas-right.active {
right: calc(100% + 30px); /*30px to get row margin back (-15px + (-15px))*/
}
}

Related

Navbar collapse does not work in Tablet View

I have a navbar that does collapse as it should in mobile view but on the tablet (or ipad pro) there is a break or large padding/gap that breaks the navigation. The testing site is at:
padding or margin bottom occurs in tablet view
I have tried a number of things like adjusting the viewport and adding links to bootstraps transition.js and collapse.js files but that is not working either.
<!--navigation bar-->
<nav class="navbar navbar-default transparent navbar-static-top" role="navigation" id="navbar-main">
<div class="container">
<div class="row">
<div class="col-sm-12">
<div class="row">
<div class="col-lg-12"> <a class="navbar-brand" href="http://patskailua.com/index.php"><img src="http://patskailua.com/images/kailua-beach-properties-llc.png" alt="pats kailua hawaiian Flower" usemap="#Map" class="img-responsive">
</a></div>
</div>
</div>
</div>
</div>
<div class="navbar-header">
<div class="text-center">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navCollapse">
<span class="sr-only">Toggle Navigation</span>
<span class="fa fa-chevron-down"></span> Menu
</button>
<div class="collapse navbar-collapse" id="navCollapse">
<ul class="nav navbar-nav navbar-right">
<li class="active goleft1">vacation rentals</li>
<li>kailua activities</li>
<li class="dropdown">
rentals by size<span class="caret black"></span>
<ul class="dropdown-menu">
<li><a href="http://patskailua.com/wp/three-bedrooms.php" >Three Bedrooms</a></li>
<li>Two Bedrooms</li>
<li>One Bedrooms</li>
<li>Studios</li>
</ul>
</li><li>contact us </li>
<li>about us</li>
<li class="dropdown">
property management and sales<span class="caret black"></span>
<ul class="dropdown-menu">
<li>Property Management</li>
<li>Buying a Property</li>
<li>Selling a Property</li>
<li class="goleft">home</li>
</li>
</ul>
</div>
</nav>
<!--end nav bar-->
If anyone has any ideas on how to fix this, that would be great. Thanks so much. -Beth
You could try changing the class col-lg-12 by col-md-12 or even col-sm-12.
This should make your navbar adapt better smaller resolutions.

To change the default bootstrap css values with less

I'm doing a site with HTML5 andbootstrap-lessnothing works normally but I needed to change some colors in the navbar menu and I know I can do this throughvariables.less inside this file I navigate to the menus where I copy all the code related to the menu that I want to edit and paste in my .less file but it does not work I do not want to have to use! important to change the menu being that I know I can do this by only variables in the less that comes in the bootsrap this is theless code of the menu
LESS:
#navbar-default-color: #fff;
#navbar-default-bg: #f8f8f8;
#navbar-default-border: darken(#navbar-default-bg, 6.5%);
//* Navbar links*/
#navbar-default-link-color: #fff;
#navbar-default-link-hover-color: #fff;
#navbar-default-link-hover-bg: transparent;
#navbar-default-link-active-color: #fff;
#navbar-default-link-active-bg: darken(#navbar-default-bg, 6.5%);
#navbar-default-link-disabled-color: #fff;
#navbar-default-link-disabled-bg: transparent;
/* Navbar brand label*/
#navbar-default-brand-color: #navbar-default-link-color;
#navbar-default-brand-hover-color: darken(#navbar-default-brand-color, 10%);
#navbar-default-brand-hover-bg: transparent;
/* Navbar toggle*/
#navbar-default-toggle-hover-bg: #fff;
#navbar-default-toggle-icon-bar-bg: #fff;
#navbar-default-toggle-border-color: #fff;
even though I change the values it does not change on my site notice that I left everything white to do a test and my site does not change:
this is my menu:
<nav class="navbar navbar-default">
<div class="container text-center">
<div class="row">
<div class="box-menu">
<div class="col-md-3">
<img src="assets/images/logo-santa-clara-eco.png" class="img-responsive" alt="Santa Clara EcoResort" />
</div>
<div class="col-md-6 hidden-xs hidden-sm">
<ul class="list-unstyled list-inline contact-info">
<li class="list"><i class="fa fa-map-marker" aria-hidden="true"></i>Rod SP 215 Km 197 - Dourado - SP</li>
<li class="list"><i class="fa fa-phone" aria-hidden="true"></i>+55 (16) 3345 4004</li>
<li class="list"><i class="fa fa-envelope" aria-hidden="true"></i>Contato</li>
</ul>
</div>
<div class="col-md-3 hidden-xs hidden-sm">
<img src="assets/images/logo_top.png" class="img-responsive logos-inline" alt="Tripadvisor L'OCITANE ABR" />
</div>
</div>
</div>
<div class="row">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" data-target="#navbarCollapse" data-toggle="collapse" class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Collection of nav links and other content for toggling -->
<div id="navbarCollapse" class="collapse navbar-collapse">
<ul class="nav navbar-nav list-nav-menu">
<li><i class="fa fa-home" aria-hidden="true"></i></li>
<li>resort</li>
<li><a href="http://santaclaraecoresort.com.br/acomodacoes.php" id="question" >acomodações</a></li>
<li>gastronomia</li>
<li>atividades</li>
<li>SPA </li>
<li>eventos</li>
<li>monitoria</li>
<li>pacotes</li>
<li>programação</li>
<li class="dropdown">
Contato <b class="caret"></b>
<ul class="dropdown-menu">
<li>Localização</li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right list-inline social-networks hidden-xs hidden-sm">
<li><i class="fa fa-facebook" aria-hidden="true"></i></li>
<li><i class="fa fa-instagram" aria-hidden="true"></i></li>
<li><i class="fa fa-youtube" aria-hidden="true"></i></li>
<li><i class="fa fa-tripadvisor" aria-hidden="true"></i></li>
</ul>
</div>
</div>
</div>
</nav>
I'm importing everything normal bootstrap``css andjs together with jquery and I'm doing# import right away
<link rel="stylesheet" href="assets/vendor/bootstrap/dist/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="assets/vendor/bootstrap/dist/js/bootstrap.min.js"></script>
my app.less file with the import:
#import "../vendor/bootstrap/less/bootstrap.less";
#import "app.css";
image of my variables with the colors I need to change, I copied the variables from the variables.less file and added it to myapp.less I changed the colors they appear on the console but they do not overwrite.
my less file with the color changes (remembering that this is a copy of thevariables.less file)

Bootstrap Centering Content within a Div

Basically I want my drop down boxes to be horizontally aligned in the center of the <div>. Currently they are in a column and inside a <div> which has displayed them vertically, by default and has pushed the content to the left of the <div>.
I'm using the latest version of bootstrap and only have CSS to pad the header and to set it as transparent!
<div class=" navbar transparent navbar-default navbar-fixed-top" role="navigation"> <!--HEADER-->
<div class="container-fluid header"> <!--CONTAINER- Needs to be inset slightly-->
<div class="row">
<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>
<!--First NavBar Colum - Logo is Located Here-->
<div class=" navbar-collapse collapse">
<div class="col-sm-4 ">
</div>
<!--Second NavBar Colum - Centered Horizontal Navigation Links are Located Here-->
<div class="col-sm-4 ">
<ul class="nav navbar-nav navbar-left">
<ul class="dropdown">
<i class="fa fa-circle-o"></i>
PLAY
<ul class="dropdown-menu">
<li class="divider"></li>
<li>Public Teatimes</li>
<li>Member Teatimes</li>
<li>Course Tour</li>
<li>Rates and Ratings</li>
<li>Outings</li>
</ul>
</ul>
<ul class="dropdown">
<i class="fa fa-circle-o"></i>
CLUB
<ul class="dropdown-menu">
<li class="divider"></li>
<li>Membership</li>
<li>Calender</li>
<li>Lessons and Shop</li>
<li>Bar and Food</li>
</ul>
</ul>
<ul>
<i class="fa fa-circle-o"></i>
CONTACT
</ul>
</ul>
</div>
<!--Third NavBar Colum - Social Media Icons are Located Here-->
<div class="col-sm-4">
<i class="fa fa-facebook-square fa-3x"></i>
<i class="fa fa-twitter-square fa-3x"></i>
<i class="fa fa-instagram fa-3x"></i>
</div>
</div> <!--/ .nav-collapse-->
</div>
</div>
</div>
In .navbar-nav, .navbar-left there is float:left . SO, you have remove that first float:none. Then on parent col-sm-4 you can add .text-center.
Try something like this
.navbar-nav{
width:250px;
margin:0 auto;
float:none;
text-align:center;
}
And remove float from <li> if you use.
#media (min-width: 768px)
.navbar-nav {
text-align: center;}

twitter Bootstrap navbar links moves when page resize

My Bootstrap navbar links including search goes away whenever I resize the page anywhere less than about 600px. What would be the cause of this? Only the logo does not move. The navbar is fine and does not resize, so I was surprised that the links went away when the page resize. I do not want any of my links to move from where they are regardless of page resizing.
code is here: HTML
http://jsfiddle.net/Crisp3333/2u0tgh5r/
<div class="menubar">
<nav role="navigation" class="navbar navbar-default">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" data-target="#navbarCollapse" data-toggle="collapse" class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<img src="yancii_logo.jpg" width="40px" height="50px">
</div>
<!-- Collection of nav links, forms, and other content for toggling -->
<div id="navbarCollapse" class="collapse navbar-collapse">
<form role="search" class="navbar-form navbar-left">
<div class="form-group">
<input type="text" placeholder="Search events, places, contacts......" class="form-control">
</div>
</form>
<ul class="nav navbar-nav">
<li>CreateEvent</li>
<li>MyEvents</li>
<li>Contacts</li>
<li class="dropdown">
<a data-toggle="dropdown" class="dropdown-toggle" href="#">Messages <b class="caret"></b></a>
<ul role="menu" class="dropdown-menu">
<li>Inbox</li>
<li>Drafts</li>
<li>Sent Items</li>
<li class="divider"></li>
<li>Trash</li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>Account</li>
</ul>
</div>
</nav>
The problem is this piece of code: /* min-width: 1400px; */
And you can find it in your class -> .navbar
It basically causes your drop-down menu not to show. And the menu buttons don't resize along as you want them to.
Hope this helps you out!
Cheers

Making the content adjust when navigation sidebar is collapsed Bootstrap

Hi I am new to CSS and bootstrap. I have a button which will make the navigation sidebar collapsible and all i need is to make the content of the page to float to the left when the navigation sidebar is collapsed and shrink if the navigation sidebar is expanded.
Kindly suggest me a solution :(
below is my sample code
<nav class="navbar navbar-default navbar-fixed-top" role="navigation" >
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header ">
<button type="button" class="navbar-toggle visible-lg" 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>
<div class="collapse navbar-default navbar-collapse" >
<div class="pull-left" id="navbar-ex1-collapse">
<ul class="nav navbar-default navbar-nav side-nav">
<li class="dropdown">
<i class="fa fa-user"></i> My Profile <b class="caret"></b>
<ul class="dropdown-menu">
<li ><a class="dropdown-color" href="#" style="background:rgba(59, 89, 152, 0.28);" ><i class="fa fa-user"></i> View Profile</a></li>
<li><a class="dropdown-color" href="#" style="background:rgba(59, 89, 152, 0.28);"><i class="fa fa-edit"></i> Edit Profile</a></li>
</ul>
</li>
<li><i class="fa fa-dashboard"></i> Dashboard</li>
<li class="dropdown">
<i class="fa fa-desktop"></i> Deployment <b class="caret"></b>
<ul class="dropdown-menu">
<li><i class="fa fa-edit"></i> Deployment Parameter</li>
<li><i class="fa fa-bar-chart-o"></i> Package Deployment</li>
<li><i class="fa fa-bar-chart-o"></i> Release Deployment</li>
</ul>
</li>
</ul>
</div>
<ul class="nav navbar-nav navbar-right navbar-user">
<li class="dropdown user-dropdown">
<i class="fa fa-user"></i> Username <b class="caret"></b>
<ul class="dropdown-menu">
<li><i class="fa fa-user"></i> View Profile</li>
<li><i class="fa fa-gear"></i> Edit Profile</li>
<li class="divider"></li>
<li><i class="fa fa-power-off"></i> Log Out</li>
</ul>
</li>
</ul>
</div><!-- /.navbar-collapse -->
<div class="auto-adjust" id="page-wrapper">
//table goes here
</div>
below is my css class which i wrote for adjusting the content
CSS:
.auto-adjust{
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
margin:0;
float:left;
}
In Twitters Less code the point that the navbar collapse has been set by #grid-float-breakpoint (set to 768px) by default. Now you can use CSS media queries to only apply your code before that point:
less
#media (max-width: (#grid-float-breakpoint - 1)) {
padding-right: 15px;
padding-left: 15px;
margin: 0 auto;
float:left;
}
CSS output:
#media (max-width: 767px) {
padding-right: 15px;
padding-left: 15px;
margin: 0 auto;
float: left;
}
Notice that you probably better can use Bootstrap's grid, see http://getbootstrap.com/css/#grid-media-queries. The xs grid will be applied when the green width is smaller than 768 pixels too.
Try the following code:
<div class="row">
<div class="col-xs-12 col-sm-6">//table goes here</div>
<div class="col-xs-12 col-sm-6">//other content</div>
</div>