megamenuのスタイル変更01(HTML・CSS)
まずは実装サンプルを確認
HTML
header.html
のファイルを変更する必要があります。
ヘッダーの差し替え
/templates/header.html
の42行目〜62行目辺りのheader
をまるごと差し替えてください。
<header> <div class="header-container"> <div class="logo"><a href="{$freo.core.http_url}"><img src="{$freo.core.http_url}images/common/logo.svg" alt="スタジオコンチーゴ株式会社" width="300" height="70"></a><span>WEBサイトガイドライン<br>レギュレーションサイト</span></div> <form action="{$freo.core.http_url}search" method="get"> <input type="text" name="word" value="{$smarty.get.word}" placeholder="キーワード検索"> <input type="submit" value=""> </form> <div class="header-sp"> <p class="header-sp-search">検索</p> <div class="hamburger"> <span></span> <span></span> <span></span> </div> </div> </div> <nav class="megamenu"> {include file='plugins/page_all/megamenu.html'} </nav> </header>↓
<header id="header-01"> <div class="header-container"> <div class="logo"><a href="{$freo.core.http_url}"><img src="{$freo.core.http_url}images/common/logo.svg" alt="スタジオコンチーゴ株式会社" width="300" height="70"></a><span>WEBサイトガイドライン<br>レギュレーションサイト</span></div> <form action="{$freo.core.http_url}search" method="get"> <input type="text" name="word" value="{$smarty.get.word}" placeholder="キーワード検索"> <input type="submit" value=""> </form> <nav class="megamenu"> {include file='plugins/page_all/megamenu#01.html'} </nav> <div class="header-sp"> <p class="header-sp-search">検索</p> <div class="hamburger"> <span></span> <span></span> <span></span> </div> </div> </div> </header>
CSS
各CSSに下記の記述を追加してください。(pc.cssの編集は不要)
style.css
/css/style.css
の/*************************** B-03. nav ***************************/
の最下部(375行目あたり)に下記の記述を追加してください。
.header-container { position: relative; } footer.overlay::after, #wrapper.overlay::after { opacity: 0; } #header-backbtn { display: none; } .header-container form { display: none; } .megamenu div { top: 61px; background-color: #ffffff; } .megamenu div > ul { display: block; position: relative; } .megamenu div li > a:hover { background: #ECECEC; } .megamenu div p { margin: 0; text-align: left; } .megamenu div p a { margin: 0; border: none; padding: 0; font-size: 18px; } .megamenu div p a::after { display: none; } .megamenu > ul > li > div > p { font-size: 2rem; font-weight: bold; margin-left: 40px; margin-bottom: 3.2rem; } .megamenu > ul { position: static; } .megamenu > ul > li { width: auto; } .megamenu li a{ font-weight: normal !important; } .megamenu > ul > li:hover > a{ border-top: none; color: #333333; opacity: 1; } .megamenu > ul > li:hover > a, .megamenu > ul > .nav_open > a { border-top: 1px solid #fff; } .megamenu > ul > li > a { font-size: 1.6rem; padding: 16px 18px; color: #707070; } .megamenu > ul > li.has-child > a::before { display: none; } .megamenu > ul > li > div > ul { min-height: 380px; } .megamenu div > ul > li { width: 100%; margin: 0; background-color: transparent; text-align: left; } .megamenu div > ul > li > div { width: auto; display: none; padding: 0; top: 0; right: 0; bottom: 0; left: 0; background: transparent; height: 100%; overflow-y: hidden; overflow-x: hidden; } .megamenu div > ul > li > a { font-size: 1.8rem; color: #222; font-weight: bold; padding: 12px 40px; font-size: 1.8rem; width: 100%; max-width: calc(100% / 3); margin: 0; background-color: transparent; text-align: left; position: relative; } .megamenu div > ul > li > a:hover { opacity: 1; } .megamenu div > ul > li > a:hover::before { content: ""; display: block; position: absolute; top: 0; left: 0; background-color: #2B85BB; width: 4px; height: 100%; } .megamenu div > ul > li.has-grandchild > a::after { content: ""; display: block; position: absolute; top: 50%; right: 24px; transform: translateY(-50%); background-image: url(/images/icons/icon-header-arrow.png); width: 18px; height: 4px; background-position: center; background-repeat: no-repeat; background-size: auto; } .megamenu div ul li.here > a::before { display: none; } .megamenu div > ul > li > ul { padding-left: 40px; } .has-grandchild > div, .has-great-grandchild > div { display: block !important; visibility: hidden; transform: translateX(-30px) !important; transition: .3s; } .has-grandchild > div.is-opened, .has-great-grandchild > div.is-opened { visibility: visible; transform: translateX(0) !important; opacity: 1; } .has-grandchild > div > ul, .has-great-grandchild > div > ul { position: static; overflow-y: scroll; height: calc(100% - 42px); } .has-grandchild > div > ul::-webkit-scrollbar, .has-great-grandchild > div > ul::-webkit-scrollbar{ display: none; } .has-grandchild > div { display: flex; flex-direction: column; margin-left: calc(100% / 3); } .has-grandchild p { padding: 12px 16px; font-size: 2rem; } .has-great-grandchild > div { margin-left: calc(100% / 2); } .has-great-grandchild > div.is-opened { background: #ECECEC; } .has-great-grandchild a { font-weight: normal !important; } .has-grandchild > div > ul > li > a { position: relative; max-width: 50% !important; } .has-great-grandchild > div a { max-width: 100% !important; } .has-great-grandchild > a::after { content: ""; display: block; position: absolute; top: 50%; right: 24px; transform: translateY(-50%); background-image: url(/images/icons/icon-header-arrow.png); width: 18px; height: 4px; background-position: center; background-repeat: no-repeat; background-size: auto; } .current-menu { position: relative; background: #ECECEC !important; } .current-menu::before { content: ""; display: block; position: absolute; top: 0; left: 0; background-color: #2B85BB; width: 4px; height: 100%; }
tablet.css
/css/tablet.css
の/*************************** B-03. nav ***************************/
の最下部(183行目あたり)に下記の記述を追加してください。
.megamenu { position: absolute; width: 100%; top: 154px; } .header-sp-search { display: none; } .header-container { background-color: #fff; } .header-container form { top: 66px; width: 100%; padding-bottom: 32px; } .header-container input[type="text"] { border-radius: 20px; } .header-container input[type="submit"] { left: -40px; border-radius: 20px; } #header-backbtn { display: none; position: absolute; z-index: 10000; top: 0; border: none; background-color: #2B85BB; color: #fff; } #header-backbtn span { position: relative; font-size: 1.2rem; padding: 4px 8px 4px 36px; margin: 0; display: inline-block; } #header-backbtn span::before { content: ""; position: absolute; width: 16px; height: 6px; left: 10px; top: 50%; border-bottom: 1px solid #fff; border-left: 1px solid #fff; transform: translateY(-50%) skew(-45deg); } #header-backbtn.header-btn-show { display: block; } .megamenu > ul > li.has-child > a:before { content: ""; display: block; position: absolute; top: 50%; right: 24px; transform: translateY(-50%); background-image: url(/images/icons/icon-header-arrow.png); width: 18px; height: 4px; background-position: center; background-repeat: no-repeat; background-size: auto; border: none; } .megamenu > ul > li > div > p { margin-left: 0; margin-bottom: 1.6rem; } .megamenu > ul > li a { padding-left: 0; border-top: 1px solid #ccc; } .megamenu > ul > li p a { border-top: none; } .is-lv1 > li > a, .is-lv2 > li > a { opacity: 0 !important; height: 0; padding: 0; display: none; } .is-lv2 li > div > ul > li > a, .is-lv2 > li > div > p { opacity: 0 !important; height: 0; padding: 0; display: none; } .is-opened a { display: block !important; } .is-lv1 > li > p, .is-lv2 > li > div > p{ margin: 0 !important; } .megamenu > ul.is-lv2 > li > a { padding: 0; } .megamenu div > ul > li { width: 100%; } .megamenu div > ul > li > a { width: 100%; max-width: 100%; padding-left: 2.4rem; } .megamenu div > ul > li > div { margin-left: 0; height: 0; } .megamenu > ul.is-lv1 > li.has-child > a { padding: 0; } .has-grandchild p, .is-lv2 .is-opened a { width: 100%; max-width: 100% !important; } .has-great-grandchild > div.is-opened { background: #fff; } .is-lv2 .is-opened, .is-lv2 .is-opened a { height: auto; opacity: 1 !important; padding: 0; } .is-lv2 .is-opened a { padding: 16px; } .is-lv2 .is-opened p { padding: 0; } .is-lv2 .is-opened p a{ padding-left: 0; } .is-lv2 .has-great-grandchild .is-opened p { text-align: center; margin: 12px auto; } .is-lv2 .has-great-grandchild .is-opened p a { font-size: 1.6rem; border: 1px solid #ccc; text-align: center; padding: 12px; } .is-lv2 .has-great-grandchild .is-opened a { padding: 10px; border: none; } .has-great-grandchild > div > ul { padding-bottom: 10px; }
smart.css
/css/smart.css
の/*************************** B-03. nav ***************************/
の最下部(79行目あたり)に下記の記述を追加してください。
.megamenu { top: 122px; padding: 0 1%; } .header-container form { width: 100%; padding: 16px 0; top: 50px; } .header-container input[type="text"] { width: 100%; height: 40px; padding: 8px 12px; margin: 0 auto; max-width: 80%; } .megamenu > ul > li > div > p a { padding-top: 1.8rem; }
Javascript
js/common.js
のファイルを変更する必要があります。