実現したいこと
ーハンバーガーメニューのテキストが現状横並びに、上から下に読む形式になっているのを、縦並びに、左から右に読む形式にしたい。
現状下記のような状態になっています。
前提
HTMLコードは現在下記のようになっています。レスポンシブ対応のSP-MENUとしてClassが設定されています。
<header> <div class="flex wrapper"> <!-- PCのナビ --> <nav class="PC-menu"> <ul class="scroll"> <li> <a href="#speciality">英文レジュメ</a> </li> <li> <a href="#service">サービス内容</a> </li> <li> <a href="#voice">お客様のお声</a> </li> <li> <a href="#contact">お問い合わせ</a> </li> </ul> </nav> <!-- タブレット、SPのナビ --> <div class="navibar-toggler"> <span></span> <span></span> <span></span> </div> <nav class="SP-menu"> <ul> <li> <a href="#speciality">英文レジュメ</a> </li> <li> <a href="#service">サービス内容</a> </li> <li> <a href="#voice">お客様のお声</a> </li> <li> <a href="#contact">お問い合わせ</a> </li> </ul> </nav> <ul class="language" style="padding-top: 2px;"> <li><a class="ja" href="https://hightouch1.com/">日本語</a></li> <li><a class="en" href="https://hightouch1.com/en/index.php">English</a></li> </ul> </div> </header>
CSSコードは現在下記のようになっております。
/* --------------------------------------------- ヘッダー -------------------------------------------- */ header { height: 96px; box-sizing: border-box; } .PC-menu { display: none; } .navibar-toggler { display: block; position: relative; height: 96px; line-height: 96px; width: 60px; z-index: 99; cursor: pointer; } .navibar-toggler span { display: inline-block; transition: all 0.4s; position: absolute; left: 5px; height: 3px; background-color: #fff; width: 50px; } .navibar-toggler span:nth-of-type(1) { top: 33px; } .navibar-toggler span:nth-of-type(2) { top: 48px; } .navibar-toggler span:nth-of-type(3) { top: 63px; } .navibar-toggler.active span:nth-of-type(1) { top: 36px; left: 7px; transform: translateY(12px) rotate(-45deg); width: 70%; } .navibar-toggler.active span:nth-of-type(2) { opacity: 0; } .navibar-toggler.active span:nth-of-type(3) { top: 60px; left: 7px; transform: translateY(-12px) rotate(45deg); width: 70%; } .SP-menu.panelactive { display: block; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: #043c5c; transition: all .6s; } .SP-menu ul { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); } .SP-menu li { padding: 30px; } .SP-menu li a{ color: #fff; font-size: 1rem; } .SP-menu li a:hover { color: #9e9e9e; } .SP-menu li a:active { color: #E2CB92; }
Javascripでは下記になります
// レスポンシブメニューの開閉 $('.navibar-toggler').click(function () { $(this).toggleClass('active'); $('.SP-menu').toggleClass('panelactive'); });
試したこと
flex-direciton:column などを追記しましたが反応しません。
よろしくお願いいたします。
回答1件
あなたの回答
tips
プレビュー