jQuery
レスポンシブ:ナビ横バー
★レスポンシブ:ナビ横バー
HTML
<nav id="globalNav"> <a class="menu" id="menu"><span>MENU</span></a> <div class="panel"> <ul> <li class="home"><a href="#">ホーム</a></li> <li><a href="#">会社案内</a></li> <li><a href="#">事業案内</a></li> <li><a href="#">導入事例</a></li> <li><a href="#">採用情報</a></li> <li><a href="#">お知らせ</a></li> <li><a href="#">お問い合わせ</a></li> </ul> </div> </nav> <!-- /ID globalNav -->
CSS
@media only screen and (min-width: 769px){ a#menu{ display: none; visibility: hidden; } nav div.panel{ display: block !important; margin: 0; text-align: center; } /* ↑↑タブレット・スマホ非表示↑↑ */ #globalNav { display: block; margin: 0; padding: 0; height: 67px; clear: both; } #globalNav ul { display: block; margin: 0; padding: 0; width: 100%; list-style: none; } #globalNav li { display: inline; } #globalNav li a { display: block; margin: 0; padding: 30px 0; width: 14%; float: left; text-align: center; list-style: none; background: #EEE; border-right: 2px solid #FFF; color: #333; letter-spacing: 0.1em; -webkit-transition: all 0.5s; -moz-transition: all 0.5s; transition: all 0.5s; } #globalNav li a:hover { background: #063; color: #FFF; } } @media only screen and (max-width: 768px){ nav#globalNav a.menu{ width: 100%; display: block; height: 20px; font-weight: bold; text-align: center; color: #fff; border: 2px solid #FFFFFF; background: #1E9FFF url(../img/header/panel.gif) no-repeat center center; letter-spacing: 0.2em; font-size: 16px; padding: 10px 0px 20px; } nav#globalNav a.menuOpen{ border-bottom: 0; color: #FFF; background: #0063AA url(../img/header/panel_hover.gif) no-repeat center center; } nav#globalNav a#menu:hover{ cursor: pointer; background: #06c url(../img/header/panel_hover.gif) no-repeat center center; } nav .panel{ display: none; width: 100%; position: relative; right: 0; top: 0; z-index: 1; } nav div.panel{float:none;} /* ↑↑タブレット・スマホ非表示↑↑ */ #globalNav { display: block; margin: 0; padding: 0; height: 67px; clear: both; } #globalNav ul { display: block; margin: 0; padding: 0; width: 100%; list-style: none; } #globalNav li { display: inline; } #globalNav li a { display: block; margin: 0 -2px 0 0; padding: 30px 0; width: 50%; float: left; text-align: center; list-style: none; background: #EEE; color: #333; letter-spacing: 0.1em; } #globalNav li.home a { display: block; margin: 0; padding: 30px 0; width: 100%; float: none; text-align: center; list-style: none; background: #EEE; color: #333; letter-spacing: 0.1em; } }
JS
<script> $(function(){$("nav div.panel").hide();$(".menu").click(function(){$(this).toggleClass("menuOpen").next().slideToggle();});}) </script>