0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00
Bootstrap/docs/examples/offcanvas.html

195 lines
7.2 KiB
HTML

---
layout: example
title: Static navbar template
---
<!-- Custom styles for this template -->
<style>
body {
padding-top: 80px;
}
/*
* Off canvas
* -------------------------------------------------- */
.row-offcanvas {
position: relative;
overflow: hidden;
.transition(all 0.25s ease-out);
}
.row-offcanvas.active {
overflow: visible;
}
.row-offcanvas-right .sidebar-offcanvas {
right: -210px; /* 60px * 3.5 = very small phones like 240x320 HTC Wildfire */
}
.row-offcanvas-left .sidebar-offcanvas {
left: -210px; /* 60px * 3.5 = very small phones like 240x320 HTC Wildfire */
}
.row-offcanvas-right.active {
right: 210px; /* 60px * 3.5 = very small phones like 240x320 HTC Wildfire */
}
.row-offcanvas-left.active {
left: 210px; /* 60px * 3.5 = very small phones like 240x320 HTC Wildfire */
}
.sidebar-offcanvas {
position: absolute;
top: 0;
}
@media screen and (max-width: 319px) {
/* This is here instead of being outside the media queries because when
* we exit "mobile land", the sidebar needs to be able to restore its
* originally authored ".col-lg-X" width. */
.sidebar-offcanvas {
width: 210px; /* 60px * 3.5 = very small phones like 240x320 HTC Wildfire */
}
}
@media screen and (min-width: 320px) and (max-width: 480px) {
.row-offcanvas-right .sidebar-offcanvas {
right: -270px; /* 60px * 4.5 = average iPhones and Android phones */
}
.row-offcanvas-left .sidebar-offcanvas {
left: -270px; /* 60px * 4.5 = average iPhones and Android phones */
}
.row-offcanvas-right.active {
right: 270px; /* 60px * 4.5 = average iPhones and Android phones */
}
.row-offcanvas-left.active {
left: 270px; /* 60px * 4.5 = average iPhones and Android phones */
}
.sidebar-offcanvas {
width: 270px; /* 60px * 4.5 = average iPhones and Android phones */
}
}
/* Landscape phone to tablets
* -------------------------- */
@media screen and (min-width: 481px) and (max-width: 767px) {
.row-offcanvas-right .sidebar-offcanvas {
right: -480px; /* 60px * 8 = Tablets and wider */
}
.row-offcanvas-left .sidebar-offcanvas {
left: -480px; /* 60px * 8 = Tablets and wider */
}
.row-offcanvas-right.active {
right: 480px; /* 60px * 8 = Tablets and wider */
}
.row-offcanvas-left.active {
left: 480px; /* 60px * 8 = Tablets and wider */
}
.sidebar-offcanvas {
width: 480px; /* 60px * 8 = Tablets and wider */
}
}
/* Tablets & above
* ---------------- */
@media screen and (min-width: 768px) {
.row-offcanvas {
position: static;
overflow: visible;
}
.sidebar-offcanvas {
position: static;
}
}
</style>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Project name</a>
<div class="nav-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
<div class="container">
<div class="row row-offcanvas row-offcanvas-right">
<div class="col col-lg-9">
<p class="pull-right visible-phone"><a href="#sidebar" class="btn btn-primary btn-offcanvas" data-toggle="offcanvas"><i class="glyphicon glyphicon-resize-horizontal"></i></a></p>
<div class="jumbotron">
<h1>Hello, world!</h1>
<p>This is an example to show the potential of an offcanvas layout pattern in Bootstrap. Try some responsive-range viewport sizes to see it in action.</p>
</div>
<div class="row">
<div class="col col-lg-4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div><!--/span-->
<div class="col col-lg-4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div><!--/span-->
<div class="col col-lg-4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div><!--/span-->
</div><!--/row-->
<div class="row">
<div class="col col-lg-4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div><!--/span-->
<div class="col col-lg-4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div><!--/span-->
<div class="col col-lg-4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div><!--/span-->
</div><!--/row-->
</div><!--/span-->
<nav class="col col-lg-3 sidebar-offcanvas" id="sidebar" role="navigation">
<div class="well sidebar-nav">
<ul class="nav nav-list">
<li class="nav-header">Sidebar</li>
<li class="active"><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li class="nav-header">Sidebar</li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li class="nav-header">Sidebar</li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
</ul>
</div><!--/.well -->
</nav><!--/span-->
</div><!--/row-->
<hr>
<footer>
<p>&copy; Company 2012</p>
</footer>
</div><!--/.container-->