materialize サイドバー テンプレート
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Title</title>
<link rel="stylesheet" href="http://fonts.googleapis.com/icon?family=Material+Icons"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.0/css/materialize.min.css"/>
</head>
<body>
<style>
/***********************************
side menu
***********************************/
header, main, footer {
padding-left: 200px;
}
@media only screen and (max-width : 992px) {
header, main, footer {
padding-left: 0;
}
}
.top-nav {
line-height: 70px !important;
}
.button-collapse{
position: absolute;
text-align: center;
height: 64px;
width: 64px;
right: 0;
top: -3px;
float: none;
margin-left: 1.5rem;
color: #fff;
font-size: 36px;
z-index: 2;
}
/***********************************
footer sticky
***********************************/
body {
display: flex;
min-height: 100vh;
flex-direction: column;
}
main {
flex: 1 0 auto;
}
</style>
<header>
<nav class="top-nav">
<div class="container">
<div class="nav-wrapper"><a class="page-title">Page title</a></div>
</div>
</nav>
<div class="container">
<a href="#" data-activates="nav-mobile" class="button-collapse top-nav full hide-on-large-only"><i class="material-icons">menu</i></a>
</div>
<ul id="nav-mobile" class="side-nav fixed" style="transform: translateX(-100%);">
<li class="logo">
<a id="logo-container" href="http://materializecss.com/" class="brand-logo">
Materiarize.com
</a>
</li>
<li class="bold">
<a href="#" class="waves-effect waves-teal">Menu1</a>
</li>
</ul>
</header>
<main>
<div class="container">
Main content
</div>
</main>
<footer class="page-footer">
<div class="container">
fotter
</div>
<div class="footer-copyright">
<div class="container">
© All rights reserved.
</div>
</div>
</footer>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.0/js/materialize.min.js"></script>
<script>
/***********************************
side menu
***********************************/
$('.button-collapse').sideNav({
menuWidth: 300, // Default is 300
edge: 'left', // Choose the horizontal origin
closeOnClick: false, // Closes side-nav on <a> clicks, useful for Angular/Meteor
draggable: true // Choose whether you can drag to open on touch screens
}
);
</script>
</body>
</html>