東京の会社辞めて地方で生きるわ。

勢いで会社を辞めて縁のない地方で生きることはできるのか

responsive nav(スマホナビゲーション) 設置方法

①headタグ内に以下記入

<link rel ="stylesheet" href="css/styles.css" type="text/css" />
<script type="text/javascript" src="js/responsive-nav.min.js"></script>

②styles.cssの編集

以下記入

/* ------------------------------------------
  NECESSARY STYLES FOR RESPONSIVE NAV
--------------------------------------------- */
.mobile_btn{
width:95%;
margin:2% auto;
height: auto;
overflow: hidden;
}

#nav-toggle{
border-radius: 10px; 
  -webkit-border-radius: 10px;
-moz-border-radius: 10px;
}



.nav-collapse ul {
  margin: 0;
  padding: 0;
  width: 100%;
  display: block;
  list-style: none;
}

.nav-collapse li {
  width: 100%;
  display: block;
}

.js .nav-collapse {
  clip: rect(0 0 0 0);
  max-height: 0;
  position: absolute;
  display: block;
  overflow: hidden;
  zoom: 1;
}

.nav-collapse.opened {
  max-height: 9999px;
}

@media screen and (min-width: 50em) {
  .js .nav-collapse {
    position: relative;
    max-height: none;
  }
  #nav-toggle {
    display: none;
  }
}


/* ------------------------------------------
  DEMO PAGE'S STYLES
--------------------------------------------- */
body, div,
h1, h2, h3, h4, h5, h6,
p, blockquote, pre, dl, dt, dd, ol, ul, li, hr,
fieldset, form, label, legend, th, td,
article, aside, figure, footer, header, hgroup, menu, nav, section,
summary, hgroup {
  margin: 0;
  padding: 0;
  border: 0;
}

a:active,
a:hover {
  outline: 0;
}

@-webkit-viewport { width: device-width; }
@-moz-viewport { width: device-width; }
@-ms-viewport { width: device-width; }
@-o-viewport { width: device-width; }
@viewport { width: device-width; }

body {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color: #37302a;
  background: #fff;
  /*font: normal 100%/1.4 sans-serif;*/
}

.nav-collapse,
.nav-collapse * {
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}

.nav-collapse,
.nav-collapse ul {
  list-style: none;
  width: 100%;
  float: left;
  margin-left:5px;
}

.nav-collapse li {
  float: left;
  width: 100%;
}

@media screen and (min-width: 50em) {
  .nav-collapse li {
    width: 14%;
    *width: 24.9%; /* IE7 Hack */
    _width: 19%; /* IE6 Hack */
  }
}

.nav-collapse a {
  color: #0000ff;
  text-decoration: none;
  width: 100%;
  background: rgb(228, 228, 252);;
  border-bottom: 1px solid white;
  padding: 0.7em 1em;
  float: left;
  font-weight:bold;
}

@media screen and (min-width: 50em) {
  .nav-collapse a {
    margin: 0;
    padding: 3px;
    float: left;
    text-align: center;
    border-bottom: 0;
    border-right: 1px solid white;
  }
}

.nav-collapse ul ul a {
  background: #ca3716;
  padding-left: 2em;
}

@media screen and (min-width: 50em) {
  .nav-collapse ul ul a {
    display: none;
  }
}

#nav-toggle {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  border: 0;
  cursor: pointer;
  width: 100%;
  height: 55px;
  float: right;
  /* text-indent: -9999px; */
  overflow: hidden;
  background: rgb(228, 228, 252);
}

@media screen and (-webkit-min-device-pixel-ratio: 1.3), screen and (min--moz-device-pixel-ratio: 1.3), screen and (-o-min-device-pixel-ratio: 2 / 1), screen and (min-device-pixel-ratio: 1.3), screen and (min-resolution: 192dpi), screen and (min-resolution: 2dppx) {
  #nav-toggle {
    background-image: url("hamburger-retina.gif");
    -webkit-background-size: 100px 100px;
    -moz-background-size: 100px 100px;
    -o-background-size: 100px 100px;
    background-size: 100px 100px;
  }


}

@media only screen and (min-width: 320px) and (max-width: 767px) {
.nav-collapse, .nav-collapse ul{
margin-left:0;
}
}

③styles.cssとresponsive-nav.min.jsをサーバーに上げてタグ直前に以下記入(wordpressならのあと)

<script>
var navigation = responsiveNav("#nav", {
customToggle: "#nav-toggle"
});
</script>

④ボタンのhtml記述

<div class="mobile_btn">
<button id="nav-toggle">Menu</button>
<div id="nav">
<ul>
<li><a href="#">test1</a></li>
<li><a href="#">test2</a></li>
<li><a href="#">test3</a></li>

</ul>
</div><!--nav-->
</div><!--mobile_btn-->