Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save thorstensiefert/5222e5f360a6f4313ffb to your computer and use it in GitHub Desktop.
Save thorstensiefert/5222e5f360a6f4313ffb to your computer and use it in GitHub Desktop.

Bootstrap Navbar Toggle Show/Hide

Wanted to make a navbar that you can toggle to be shown or hidden. Needed something alike for a fullscreen map project I am working on. click the arrow to hide the navbar

A Pen by Clint Bettiga on CodePen.

License.

#background
.navbar.navbar-fixed-top
%nav.navbar-inner.header
.container
.brand
IN THE CLOUDS <i class="fa fa-cloud" style="text-shadow: 1px 1px white, -1px -1px #666;"></i>
%ul.nav.pull-right
%li
%a.nav-link
TUTORIALS
%li
%a.nav-link
MODELS
%li
%a.nav-link
PLACES
%li.dropdown
%a.dropdown-toggle.nav-link{:"data-toggle" => "dropdown"}
DROP
%ul.dropdown-menu.text-center
%li
%a
Example 1
%li
%a
Example 2
%li
%a
Example 3
.triangle-down.center
%p
%i.fa.fa-chevron-down.fa-2x#toggle.isDown
%br
#content
.row-fluid
.span12{:style => "background-color:rgba(0, 0, 0, .8);"}
.row-fluid
.span4.offset4
%br
%h1.threed.text-center{:style => "letter-spacing:4px"}
THIS IS A TITLE
.row-fluid
.span4.offset4
%h1.threed.text-center{:style => "letter-spacing:10px;margin-top:-30px;"}
___________
.row-fluid
.span6.text-right
.row-fluid
%h2.threed
What should go into this box?
.row-fluid
%h4
Lorem ipsum dolor sit amet, quodsi impedit neglegentur id mea. Solum quando ubique has eu. Eu usu latine nostrud, sit temporibus suscipiantur id. Quo nulla aliquid deterruisset eu, id legere vidisse per, sed saperet consulatu deterruisset ne.
%br
.row-fluid
.btn
CLICK ME
%i.fa.fa-heart
.span6.text-left
.span5.text-center
%i#big-cloud.fa.fa-cloud{:style => "text-shadow: 1px 1px white, -1px -1px #666;"}
.span6.text-left
%h5 Lorem ipsum dolor sit amet, quodsi impedit neglegentur id mea. Solum quando ubique has eu. Eu usu latine nostrud, sit temporibus suscipiantur id. Quo nulla aliquid deterruisset eu, id legere vidisse per, sed saperet consulatu deterruisset ne.
%h5 Lorem ipsum dolor sit amet, quodsi impedit neglegentur id mea. Solum quando ubique has eu. Eu usu latine nostrud, sit temporibus suscipiantur id.
%br
%br
.row-fluid
.span12{:style => "background-color:rgba(0, 0, 0, .8);"}
.span4
.row-fluid
%h1.threed.text-left
WHO
.row-fluid
%h1.threed.text-center
WE &nbsp
.row-fluid
%h1.threed.text-right
ARE ...
%br
.span8
%br
%br
.span2
%img.team-img{:src => "http://placehold.it/100x100"}
.span2.offset1
%img.team-img{:src => "http://placehold.it/100x100"}
.span2.offset1
%img.team-img{:src => "http://placehold.it/100x100"}
.span2.offset1
%img.team-img{:src => "http://placehold.it/100x100"}
%br
.row-fluid
.span12{:style => "background-color:rgba(0, 0, 0, .8);"}
.span6
.row-fluid
.span1.text-center
%h3
&nbsp<i class="fa fa-skype text-left"></i>
.span11.text-right
%h3
+ 1 707 707 7007
.row-fluid
.span1.text-center
%h3
&nbsp<i class="fa fa-envelope text-left"></i>
.span11.text-right
%h3
INFO@INTHECLOUDS.COM
.row-fluid
.span1.text-center
%h3
&nbsp<i class="fa fa-twitter text-left"></i>
.span11.text-right
%h3
@INTHECLOUDS
.row-fluid
.span1.text-center
%h3
&nbsp<i class="fa fa-facebook text-left"></i>
.span11.text-right
%h3
FACEBOOK.COM/INTHECLOUDS
.span6
.span10.offset1.text-center
%h2 GET IN TOUCH
%i.fa.fa-comments.fa-4x
%h4
Lorem ipsum dolor sit amet, quodsi impedit neglegentur id mea. Solum quando ubique has eu. Eu usu latine nostrud, sit temporibus suscipiantur id.
//cloud footer :)
.navbar.navbar-fixed-bottom
%nav.navbar-inner.footer
%br
%br
%br
%br
$("#toggle").click( function(event){
event.preventDefault();
if ($(this).hasClass("isDown") ) {
$( ".navbar-fixed-top" ).animate({ "margin-top": "-62px" }, "fast" );
$( "#content" ).animate({ "margin-top": "5px" }, "fast" );
$(this).removeClass("isDown");
} else {
$( ".navbar-fixed-top" ).animate({ "margin-top": "0px" }, "fast" );
$( "#content" ).animate({ "margin-top": "80px" }, "fast" );
$(this).addClass("isDown");
}
return false;
});
*{
font-family: Futura, "Trebuchet MS", Arial, sans-serif;
}
html, body {
height: 100%;
margin: 0;
background: url(http://imageshack.us/a/img35/3203/kl31.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
#content{
margin-top:80px;
color:white;
}
.navbar-inner li{
line-height: 40px;
letter-spacing:2px;
}
.nav-link{
border-top: 4px solid white;
transition: border-top .3s;
&:hover{border-top: 4px solid dodgerblue;}
}
.dropdown-menu li > a:hover, .dropdown-menu li > a:focus, .dropdown-submenu:hover > a{
background-image:none;
background-color:dodgerblue;
}
.brand{
letter-spacing:4px;
border-top: 4px solid white;
transition: border-top .3s;
&:hover{border-top: 4px solid dodgerblue;}
&:hover{border-top: 4px solid dodgerblue;}
}
.header{
background-color: rgba(255,255,255, .95);
/* remove the gradient */
background-image: none !important;
border-bottom:2px solid dodgerblue !important;
line-height: 40px !important;
box-shadow: 0 12px 6px -6px rgba(0,0,0, .2) !important;
}
.footer{
background: linear-gradient(to bottom, rgba(255,255,255,0) 0%,rgba(255,255,255,.3) 100%); /* W3C */
/* remove the gradient */
border: 0 !important;
box-shadow: none !important;
}
.center {
margin: auto;
position: absolute;
left: 0; right: 0;
}
.triangle-down {
position:fixed;
margin-top:65px;
width: 0;
height: 0;
border-left: 30px solid transparent;
border-right: 30px solid transparent;
border-top: 30px solid dodgerblue;
}
.triangle-down p{
text-align:center;
color:white;
margin-top:-33px;
margin-left:-13px;
transition:color .2s;
&:hover{color: rgba(0, 0, 0, .4)}
}
.threed{
color:white;
text-shadow: 0 1px 0 #333,
0 2px 0 #333,
0 3px 0 #333,
0 4px 0 #333,
0 5px 0 #333,
0 3px 1px rgba(255,255,255,.1)
}
h3{
transition: color .5s;
&:hover{color:rgba(36, 142, 255, .8);}
}
#big-cloud{
color:rgb(255,255,255);
opacity:.8;
font-size:200px;
text-shadow: 1px 1px white, -1px -1px #666;
}
.dropdown-menu::before,
.dropdown-menu::after {
border: none;
content: none !important;
}
.dropdown-menu{
border-radius:3%;
z-index:-3;
margin-top:-10px;
margin-right: -60% !important;
}
.team-img{
border-radius:50%;
border:10px solid rgba(255,255,255,1);
-webkit-box-shadow: 0 8px 6px -6px black;
-moz-box-shadow: 0 8px 6px -6px black;
box-shadow: 0 8px 6px -6px black;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment