"Admin Side Menu "
Bootstrap 3.2.0 Snippet by 高级放牛娃

<link href="//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="row"> <!-- uncomment code for absolute positioning tweek see top comment in css --> <!-- <div class="absolute-wrapper"> </div> --> <!-- Menu --> <div class="side-menu"> <nav class="navbar navbar-default" role="navigation"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <div class="brand-wrapper"> <!-- Hamburger --> <button type="button" 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> <!-- Brand --> <div class="brand-name-wrapper"> <a class="navbar-brand" href="#">商标</a> </div> <!-- Search --> <a data-toggle="collapse" href="#search" class="btn btn-default" id="search-trigger"> <span class="glyphicon glyphicon-search"></span> </a> <!-- Search body --> <div id="search" class="panel-collapse collapse"> <div class="panel-body"> <form class="navbar-form" role="search"> <div class="form-group"> <input type="text" class="form-control" placeholder="Search"> </div> <button type="submit" class="btn btn-default "><span class="glyphicon glyphicon-ok"></span></button> </form> </div> </div> </div> </div> <!-- Main Menu --> <div class="side-menu-container"> <ul class="nav navbar-nav"> <li><a href="#"><span class="glyphicon glyphicon-send"></span> 菜单1 </a></li> <li class="active"><a href="#"><span class="glyphicon glyphicon-plane"></span> 当前链接</a></li> <li><a href="#"><span class="glyphicon glyphicon-cloud"></span> 菜单2 </a></li> <!-- Dropdown--> <li class="panel panel-default" id="dropdown"> <a data-toggle="collapse" href="#dropdown-lvl1"> <span class="glyphicon glyphicon-user"></span> 子菜单 <span class="caret"></span> </a> <!-- Dropdown level 1 --> <div id="dropdown-lvl1" class="panel-collapse collapse"> <div class="panel-body"> <ul class="nav navbar-nav"> <li><a href="#">菜单1</a></li> <li><a href="#">菜单2</a></li> <li><a href="#">菜单3</a></li> <!-- Dropdown level 2 --> <li class="panel panel-default" id="dropdown"> <a data-toggle="collapse" href="#dropdown-lvl2"> <span class="glyphicon glyphicon-off"></span> 子菜单 <span class="caret"></span> </a> <div id="dropdown-lvl2" class="panel-collapse collapse"> <div class="panel-body"> <ul class="nav navbar-nav"> <li><a href="#">菜单1</a></li> <li><a href="#">菜单2</a></li> <li><a href="#">菜单3</a></li> </ul> </div> </div> </li> </ul> </div> </div> </li> <li><a href="#"><span class="glyphicon glyphicon-signal"></span> 菜单3 </a></li> </ul> </div><!-- /.navbar-collapse --> </nav> </div> <!-- Main Content --> <div class="container-fluid"> <div class="side-body"> <h1> 五月印象 </h1> <pre> Resize the screen to view the left slide menu </pre> <p>又是一年五月来临,金黄色的杏子从绿饼似的杏叶中间微微探出头来,娇羞地张望着来来往往的路人,好像在和路人玩捉迷藏的游戏;桃树也垂下她袅娜的身姿,让过往路人来见证的她硕果累累,几颗桃子笑着玩着,把脸都羞红了;麦田里金光闪闪,麦穗谦虚地低下了头,面向黄土,背朝天。</p> <p>五月是收获的季节。这时候华北平原的麦子由翠绿变为金黄,它们相互簇拥着,你推我攘,互不谦让,像赶集似的。收割机缓缓地开到了田地里,准备着把她的孩子从大地里接回家,让它们免受风吹雨打,粒粒麦子滑入农民事先准备好的口袋中。一阵风掠过,农民脸上泛起了阵阵涟漪,嘴角翘的像弯弯的月牙一般。 现在的人们已经不需要再去用镰刀去收获小麦了,一些都已走上了机械化道路。 依稀记得以前收获麦子的时候需要一个多月,那时候没有联合收割机,于是农民不得不用镰刀去割每一棵麦子。五月天气已经有点燥热了,天微微亮,有劳动能力的男女老少就开始到麦田里去收割麦子了,那时麦田里可真是壮观。麦子割下来之后就要用到石磙了,农民把割下来的麦苗都集中到一个空旷而又干净的空地里,然后让黄牛拉着石磙在麦苗上来回碾压,一圈又一圈。天气总是喜欢温暖一点,但太阳底下的黄牛和石磙配合默契,一粒粒麦子渐渐地脱去他们薄薄的纱衣,露出微黄的肌肤。那是土地的颜色,那是我们的颜色。碾压过后的麦子如出水芙蓉般洁净,等到哪天大风袭来,农民就会把装好的麦子全部拉出来扬场,一个人用木锨把麦子朝着空中扬洒,而另一个人则用扫帚不停地在落下来的麦子上清扫。这时扫麦子的人最好戴上一顶草帽,否则那么多小麦如下雨一般齐涮涮的向你头顶砸去,那个滋味可不是好受的。</p> <p>麦季就这样持续一个多月。这时候的孩子也是快乐的,因为收麦子的时候学校会放假,让孩子帮着家人去收割麦子。顽皮的孩子会跑到秸秆垛上面鬼疯,他们时而上时而下,有时干脆从秸秆垛上直接蹦将下来。那秸秆垛好像就是他们的蹦床,就是他们的游乐园。有些孩子直接爬上像金字塔形状的麦子堆里,踩在已经装满麦子的口袋上,在里面玩奥特曼打怪兽和天女散花的游戏。刚装好的麦子就这样被几个顽童挥洒的到处都是。这时候大人可不愿意了,扬起巴掌就要向孩子们的屁股上打将上去,像是芭蕉扇一般要把孩子扇得远远的,其实只是吓唬吓唬孩子罢了。然而孩子并不吃这一套,于是大人改变战术,从口袋里拿出几元钱让孩子去买雪糕吃。这是常有的事情,每当这个时候,孩子们就会蹦着跳着朝商店奔去,然后带回一大包雪糕,坐在一起吃着笑着。</p> <p>已而夕阳下山,劳累了一天的大人和孩子带着丰收的喜悦回到家中。炊烟袅袅,几户人家已经开始生火做饭了,女主人公会做出许多美味佳肴来缓解这一天的疲劳,男主人公总会在这个时候喝点啤酒来消一消暑气。鸭蛋和松花蛋可以说是每家过麦季必有的食品,蛋黄里的黄油欲滴,香而不腻,松花蛋清凉可口,解暑降温。而孩子对这些是没有兴趣的,于是他们毫不客气地抱着一半西瓜啃起来,弄得脸上嘴上全是西瓜。有的孩子把西瓜上面撒些白糖,用勺子舀着吃,上面一层糖吃完了,又撒了一层糖,边吃边往西瓜里面铺白糖,到最后,一袋白糖就这样吃光了。孩子的创造力你永远无法想象,他们把吃完的半块西瓜皮戴在头上当帽子,以此来防暑解暑。或者用小刀把它雕刻成各种奇特的形状,又或者直接把西瓜皮切成块状,扔在河里打水漂,厉害的孩子能打六七个水漂,甚至更多。</p> <p>夏天的夜晚微凉,微风阵阵,几个孩子在大树下傻傻地数着星星。一颗,两颗,三颗…….夜渐渐深了,孩子在蒲扇的摇动下进入了甜蜜的梦乡,一家人也都渐渐地入睡了,等待着第二天黎明的到来。</p> </div> </div> </div>
:focus { outline: none; } .row { margin-right: 0; margin-left: 0; } /* Sometimes the sub menus get too large for the page and prevent the menu from scrolling, limiting functionality A quick fix is to change .side-menu to -> position:absolute and uncomment the code below. You also need to uncomment -> <div class="absolute-wrapper"> </div> in the html file you also need to tweek the animation. Just uncomment the code in that section -------------------------------------------------------------------------------------------------------------------- If you want to make it really neat i suggest you look into an alternative like http://areaaperta.com/nicescroll/ This will allow the menu to say fixed on body scoll and scoll on the side bar if it get to large */ /*.absolute-wrapper{ position: fixed; width: 300px; height: 100%; background-color: #f8f8f8; border-right: 1px solid #e7e7e7; }*/ .side-menu { position: fixed; width: 300px; height: 100%; background-color: #f8f8f8; border-right: 1px solid #e7e7e7; } .side-menu .navbar { border: none; } .side-menu .navbar-header { width: 100%; border-bottom: 1px solid #e7e7e7; } .side-menu .navbar-nav .active a { background-color: transparent; margin-right: -1px; border-right: 5px solid #575757; } .side-menu .navbar-nav li { display: block; width: 100%; border-bottom: 1px solid #e7e7e7; } .side-menu .navbar-nav li a { padding: 15px; } .side-menu .navbar-nav li a .glyphicon { padding-right: 10px; } .side-menu #dropdown { border: 0; margin-bottom: 0; border-radius: 0; background-color: transparent; box-shadow: none; } .side-menu #dropdown .caret { float: right; margin: 9px 5px 0; } .side-menu #dropdown .indicator { float: right; } .side-menu #dropdown > a { border-bottom: 1px solid #e7e7e7; } .side-menu #dropdown .panel-body { padding: 0; background-color: #f3f3f3; } .side-menu #dropdown .panel-body .navbar-nav { width: 100%; } .side-menu #dropdown .panel-body .navbar-nav li { padding-left: 15px; border-bottom: 1px solid #e7e7e7; } .side-menu #dropdown .panel-body .navbar-nav li:last-child { border-bottom: none; } .side-menu #dropdown .panel-body .panel > a { margin-left: -20px; padding-left: 35px; } .side-menu #dropdown .panel-body .panel-body { margin-left: -15px; } .side-menu #dropdown .panel-body .panel-body li { padding-left: 30px; } .side-menu #dropdown .panel-body .panel-body li:last-child { border-bottom: 1px solid #e7e7e7; } .side-menu #search-trigger { background-color: #f3f3f3; border: 0; border-radius: 0; position: absolute; top: 0; right: 0; padding: 15px 18px; } .side-menu .brand-name-wrapper { min-height: 50px; } .side-menu .brand-name-wrapper .navbar-brand { display: block; } .side-menu #search { position: relative; z-index: 1000; } .side-menu #search .panel-body { padding: 0; } .side-menu #search .panel-body .navbar-form { padding: 0; padding-right: 50px; width: 100%; margin: 0; position: relative; border-top: 1px solid #e7e7e7; } .side-menu #search .panel-body .navbar-form .form-group { width: 100%; position: relative; } .side-menu #search .panel-body .navbar-form input { border: 0; border-radius: 0; box-shadow: none; width: 100%; height: 50px; } .side-menu #search .panel-body .navbar-form .btn { position: absolute; right: 0; top: 0; border: 0; border-radius: 0; background-color: #f3f3f3; padding: 15px 18px; } /* Main body section */ .side-body { margin-left: 310px; } /* small screen */ @media (max-width: 768px) { .side-menu { position: relative; width: 100%; height: 0; border-right: 0; border-bottom: 1px solid #e7e7e7; } .side-menu .brand-name-wrapper .navbar-brand { display: inline-block; } /* Slide in animation */ @-moz-keyframes slidein { 0% { left: -300px; } 100% { left: 10px; } } @-webkit-keyframes slidein { 0% { left: -300px; } 100% { left: 10px; } } @keyframes slidein { 0% { left: -300px; } 100% { left: 10px; } } @-moz-keyframes slideout { 0% { left: 0; } 100% { left: -300px; } } @-webkit-keyframes slideout { 0% { left: 0; } 100% { left: -300px; } } @keyframes slideout { 0% { left: 0; } 100% { left: -300px; } } /* Slide side menu*/ /* Add .absolute-wrapper.slide-in for scrollable menu -> see top comment */ .side-menu-container > .navbar-nav.slide-in { -moz-animation: slidein 300ms forwards; -o-animation: slidein 300ms forwards; -webkit-animation: slidein 300ms forwards; animation: slidein 300ms forwards; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; } .side-menu-container > .navbar-nav { /* Add position:absolute for scrollable menu -> see top comment */ position: fixed; left: -300px; width: 300px; top: 43px; height: 100%; border-right: 1px solid #e7e7e7; background-color: #f8f8f8; -moz-animation: slideout 300ms forwards; -o-animation: slideout 300ms forwards; -webkit-animation: slideout 300ms forwards; animation: slideout 300ms forwards; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; } /* Uncomment for scrollable menu -> see top comment */ /*.absolute-wrapper{ width:285px; -moz-animation: slideout 300ms forwards; -o-animation: slideout 300ms forwards; -webkit-animation: slideout 300ms forwards; animation: slideout 300ms forwards; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; }*/ @-moz-keyframes bodyslidein { 0% { left: 0; } 100% { left: 300px; } } @-webkit-keyframes bodyslidein { 0% { left: 0; } 100% { left: 300px; } } @keyframes bodyslidein { 0% { left: 0; } 100% { left: 300px; } } @-moz-keyframes bodyslideout { 0% { left: 300px; } 100% { left: 0; } } @-webkit-keyframes bodyslideout { 0% { left: 300px; } 100% { left: 0; } } @keyframes bodyslideout { 0% { left: 300px; } 100% { left: 0; } } /* Slide side body*/ .side-body { margin-left: 5px; margin-top: 70px; position: relative; -moz-animation: bodyslideout 300ms forwards; -o-animation: bodyslideout 300ms forwards; -webkit-animation: bodyslideout 300ms forwards; animation: bodyslideout 300ms forwards; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; } .body-slide-in { -moz-animation: bodyslidein 300ms forwards; -o-animation: bodyslidein 300ms forwards; -webkit-animation: bodyslidein 300ms forwards; animation: bodyslidein 300ms forwards; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; } /* Hamburger */ .navbar-toggle { border: 0; float: left; padding: 18px; margin: 0; border-radius: 0; background-color: #f3f3f3; } /* Search */ #search .panel-body .navbar-form { border-bottom: 0; } #search .panel-body .navbar-form .form-group { margin: 0; } .navbar-header { /* this is probably redundant */ position: fixed; z-index: 3; background-color: #f8f8f8; } /* Dropdown tweek */ #dropdown .panel-body .navbar-nav { margin: 0; } }
$(function () { $('.navbar-toggle').click(function () { $('.navbar-nav').toggleClass('slide-in'); $('.side-body').toggleClass('body-slide-in'); $('#search').removeClass('in').addClass('collapse').slideUp(200); /// uncomment code for absolute positioning tweek see top comment in css //$('.absolute-wrapper').toggleClass('slide-in'); }); // Remove menu for searching $('#search-trigger').click(function () { $('.navbar-nav').removeClass('slide-in'); $('.side-body').removeClass('body-slide-in'); /// uncomment code for absolute positioning tweek see top comment in css //$('.absolute-wrapper').removeClass('slide-in'); }); });

Related: See More


Questions / Comments: