1、引入文件
<script src="js/jquery.min.js"></script> <script src="js/simpler-sidebar.min.js"></script>
2、HTML
<div class="sidebar main left" id="sidebar-main"> <div class="wrapper"> <nav> <ul> <li class="title">Playground</li> <li><a href="#">Home</a></li> <li><a href="#">Right</a></li> <li><a href="#">Right Top</a></li> <li><a href="#">Left</a></li> <li><a href="#">Left Top</a></li> <li><a href="#">jQuery v2</a></li> </ul> </nav> </div> </div>
3、CSS
.sidebar-wrapper { position: relative; height: 100%; overflow: auto; }
4、JavaScript
$( "document" ).ready( function() { var $mainSidebar = $( "#sidebar-main" ); $mainSidebar.simplerSidebar( { attr: "sidebar-main", selectors: { trigger: "#sidebar-main-trigger", quitter: ".quitter" }, animation: { easing: "easeOutQuint" } } ); } );