質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
jQuery

jQueryは、JavaScriptライブラリのひとつです。 簡単な記述で、JavaScriptコードを実行できるように設計されています。 2006年1月に、ジョン・レシグが発表しました。 jQueryは独特の記述法を用いており、機能のほとんどは「$関数」や「jQueryオブジェクト」のメソッドとして定義されています。

HTML

HTMLとは、ウェブ上の文書を記述・作成するためのマークアップ言語のことです。文章の中に記述することで、文書の論理構造などを設定することができます。ハイパーリンクを設定できるハイパーテキストであり、画像・リスト・表などのデータファイルをリンクする情報に結びつけて情報を整理します。現在あるネットワーク上のほとんどのウェブページはHTMLで作成されています。

CSS

CSSはXMLやHTMLで表現した色・レイアウト・フォントなどの要素を指示する仕様の1つです。

Q&A

解決済

2回答

502閲覧

ウィンドウを小さくした際のメニューの背景色について

sutosi

総合スコア27

jQuery

jQueryは、JavaScriptライブラリのひとつです。 簡単な記述で、JavaScriptコードを実行できるように設計されています。 2006年1月に、ジョン・レシグが発表しました。 jQueryは独特の記述法を用いており、機能のほとんどは「$関数」や「jQueryオブジェクト」のメソッドとして定義されています。

HTML

HTMLとは、ウェブ上の文書を記述・作成するためのマークアップ言語のことです。文章の中に記述することで、文書の論理構造などを設定することができます。ハイパーリンクを設定できるハイパーテキストであり、画像・リスト・表などのデータファイルをリンクする情報に結びつけて情報を整理します。現在あるネットワーク上のほとんどのウェブページはHTMLで作成されています。

CSS

CSSはXMLやHTMLで表現した色・レイアウト・フォントなどの要素を指示する仕様の1つです。

0グッド

0クリップ

投稿2017/09/08 15:02

このサイトのウィンドウを小さくするとレスポンシブデザインのメニューが出てくるのですがmeanmenu内の色をいじってみたのですが全く変わらずどこを操作したらよろしいでしょうか。

html

1<!DOCTYPE html> 2<html lang="ja"> 3<head> 4 <meta charset="utf-8"> 5 <meta name="viewport" content="width=device-width, initial-scale=1.0"><!-- baneではなくname --> 6 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> 7 <link rel="stylesheet" href="https://cdn.jsdelivr.net/jquery.meanmenu/2.0.6/meanmenu.min.css"> 8 <link rel="stylesheet" href="css/font-awesome.min.css"> 9 <!--インストールしたfontawesomeを読み込む--> 10 <link rel="stylesheet" href="css/styles.css"> 11 <!--作ったCSSを読み込む--> 12 <meta bane="viewport" content="width=device-width, initial-scale=1.0"> 13 <!--スマホで開いたとき度の幅で描画するかの設定--> 14 15 <title>RWD</title> 16</head> 17 18<body> 19<header> 20 21 <div class="container"> 22 <!-- <i class="fa fa-bars mobile-menu" aria-hidden="true"></i>--> 23 <ul class="pc-menu"> 24 <li>Menu</li> 25 <li>Menu</li> 26 <li>Menu</li> 27 </ul> 28 <h1 class="aburasoba">油そば池袋</h1> 29 </div> 30 31 <section class="features"><!--section1--> 32 <h2>Features</h2> 33 <div class="item"> 34 <img src="img/feature.jpg"> 35 <p class="right-side">hello. hello. hello. hello. hello. hello. hello. 36 hello. hello. hello. hello. hello. hello. hello. hello. hello. </p> 37 </div> 38 39 <div class="item"> 40 <img src="img/feature.jpg"> 41 <p class="left-side">hello. hello. hello. hello. hello. hello. hello. 42 hello. hello. hello. hello. hello. hello. hello. hello. hello. </p> 43 </div> 44 45 <div class="item"> 46 <img src="img/feature.jpg"> 47 <p class="right-sidet">hello. hello. hello. hello. hello. hello. hello. 48 hello. hello. hello. hello. hello. hello. hello. hello. hello. </p> 49 </div> 50 </section> 51</header> 52 <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> 53 <script src="https://cdn.jsdelivr.net/jquery.meanmenu/2.0.6/jquery.meanmenu.js"></script> 54 <script> 55 $(function () { 56 $("div.container").meanmenu({}); 57 }); 58 </script> 59 60 <footer> 61 <div class="sita"> 62 <img src="img/footer.png"> 63 </div> 64 </footer> 65 66</body> 67 68 69</html> 70

css

1/*1----------------------------------------------------------------------------------*/ 2@charset "utf-8"; 3/*common*/ 4 5body{/*初期設定、余計なmargin,paddingを0に*/ 6font-size: 14px; 7font-family: Verdana, sans-serif; 8margin: 0; 9padding: 0; 10color: #333; 11background: #F2F2F2; 12/*初期設定*/ 13} 14p{/*行間がゆったりする*/ 15line-height: 2; 16} 17 18.container{/*ここで90%の意味はmysiteという上の文字や写真、写真のコメントなどをかこんでいて 19 左右に一定の空きができる*/ 20 width: 90%; 21 margin: 0 auto; 22} 23 24/*header-mobile-menuはアイコン右寄せ*/ 25.mobile-menu{ 26float: right; 27font-size: 24px; 28cursor: pointer; 29} 30 31.pc-menu{ 32display: none; 33} 34 35.pc-menu{ 36display: block;/*要素の表示形式をしていするっぽい、ブロック要素を表示,,*/ 37/*46行目にheader-pc-menuを見えない設定をして、ここで820px以上いくとここで表示させる*/ 38list-style: none; 39padding: 10px; 40margin: 0; 41/*余計なマージンパディング取る、*/ 42float: right;/*mysiteも入っているheader-pc-menuの中に右にする設定*/ 43} 44 45.pc-menu > li { 46display: inline-block;/*横にする設定*/ 47width: 60px; 48text-align: center; 49cursor: pointer; 50} 51 52/*sita ...imgと指定すれば画像が指定できた*/ 53.sita img { 54 display: block; 55 height: 50px; 56 margin: 0 auto; 57 width: 50px; 58} 59 60 61/*レスポンシブルデザイン設定①*/ 62/*幅の大きさが変わる設定*/ 63/*画面が570px以下になったとき*/ 64@media (max-width: 414px){ 65 .pc-menu{/*アイコンを消す*/ 66 display: none; 67 } 68 .aburasoba{/*アイコンを消す*/ 69 display: none; 70 } 71.features p{ 72 width: 45%; 73} 74.features img{ 75 width: 50%; 76} 77/*.pull-right*/ 78.right-side{ 79 float: right; 80 padding-left: 5%; 81} 82/*.pull-left*/ 83.left-side{ 84 float: left; 85 padding-right: 5%; 86} 87.features .item{/*float:leftやrightを使ったので*/ 88 overflow: hidden; 89} 90.news .container{ 91 display: flex; 92 justify-content: space-between;/*均等に余白が空く設定*/ 93} 94.news .item{/*newsに入っている画像と文字に対して30%*/ 95 width: 30%; 96} 97.news .item img{/*画像が30%だとちゃんと見えないので画像だけ100%に*/ 98 width: 100%; 99} 100} 101/*画面が570px以上になったとき 102min-widthが〇〇以上、max-widthが〇〇までという認識*/ 103@media (min-width: 414px){ 104.container{ 105 width: 414px; 106} 107.mobile-menu{/*アイコンを消す*/ 108display: none; 109} 110} 111/*1----------------------------------------------------------------------------------*/ 112 113section{/*共通のスタイル、上下にサイズがほしい*/ 114 padding: 60px 0; 115} 116 117section h2{/*文字を中央ぞろえ、下にマージン空き*/ 118 text-align: center; 119} 120 121section:nth-child(even){/*背景色の切り替え*/ 122 background: #fff; 123} 124 125/*features*/ 126.features img{/*親要素音containerに対して100%の設定なので左右ぴったりになった*/ 127 width: 100%; 128} 129 130.features .item{/*写真と文字を囲っているfeaturesの下の空き*/ 131 margin-bottom: 60px; 132 margin-left: 60px; 133 margin-right: 60px; 134} 135 136.features .item:last-child{/*これにだけ指定という意味*/ 137 margin-bottom: 0; 138} 139 140.news .item:last-child{/*これにだけ指定という意味*/ 141 margin-bottom: 0; 142} 143 144/*footer*/ 145 146footer { 147 text-align: center; 148 padding: 10px 0; 149} 150

meanmenu.css

1 2/*! ####################################################################### 3 4 MeanMenu 2.0.7 5 -------- 6 7 To be used with jquery.meanmenu.js by Chris Wharton (http://www.meanthemes.com/plugins/meanmenu/) 8 9####################################################################### */ 10 11/* hide the link until viewport size is reached */ 12a.meanmenu-reveal { 13 display: none; 14} 15 16/* when under viewport size, .mean-container is added to body */ 17.mean-container .mean-bar { 18 float: left; 19 width: 100%; 20 position: relative; 21 background: #0c1923; 22 padding: 4px 0; 23 min-height: 42px; 24 z-index: 999999; 25} 26 27.mean-container a.meanmenu-reveal { 28 width: 22px; 29 height: 22px; 30 padding: 13px 13px 11px 13px; 31 position: absolute; 32 top: 0; 33 right: 0; 34 cursor: pointer; 35 color: #fff; 36 text-decoration: none; 37 font-size: 16px; 38 text-indent: -9999em; 39 line-height: 22px; 40 font-size: 1px; 41 display: block; 42 font-family: Arial, Helvetica, sans-serif; 43 font-weight: 700; 44} 45 46.mean-container a.meanmenu-reveal span { 47 display: block; 48 background: #fff; 49 height: 3px; 50 margin-top: 3px; 51} 52 53.mean-container .mean-nav { 54 float: left; 55 width: 100%; 56 background: #0c1923; 57 margin-top: 44px; 58} 59 60.mean-container .mean-nav ul { 61 padding: 0; 62 margin: 0; 63 width: 100%; 64 list-style-type: none; 65} 66 67.mean-container .mean-nav ul li { 68 position: relative; 69 float: left; 70 width: 100%; 71} 72 73.mean-container .mean-nav ul li a { 74 display: block; 75 float: left; 76 width: 90%; 77 padding: 1em 5%; 78 margin: 0; 79 text-align: left; 80 color: #fff; 81 border-top: 1px solid #383838; 82 border-top: 1px solid rgba(255,255,255,0.5); 83 text-decoration: none; 84 text-transform: uppercase; 85} 86 87.mean-container .mean-nav ul li li a { 88 width: 80%; 89 padding: 1em 10%; 90 border-top: 1px solid #f1f1f1; 91 border-top: 1px solid rgba(255,255,255,0.25); 92 opacity: 0.75; 93 filter: alpha(opacity=75); 94 text-shadow: none !important; 95 visibility: visible; 96} 97 98.mean-container .mean-nav ul li.mean-last a { 99 border-bottom: none; 100 margin-bottom: 0; 101} 102 103.mean-container .mean-nav ul li li li a { 104 width: 70%; 105 padding: 1em 15%; 106} 107 108.mean-container .mean-nav ul li li li li a { 109 width: 60%; 110 padding: 1em 20%; 111} 112 113.mean-container .mean-nav ul li li li li li a { 114 width: 50%; 115 padding: 1em 25%; 116} 117 118.mean-container .mean-nav ul li a:hover { 119 background: #252525; 120 background: rgba(255,255,255,0.1); 121} 122 123.mean-container .mean-nav ul li a.mean-expand { 124 margin-top: 1px; 125 width: 26px; 126 height: 32px; 127 padding: 12px !important; 128 text-align: center; 129 position: absolute; 130 right: 0; 131 top: 0; 132 z-index: 2; 133 font-weight: 700; 134 background: rgba(255,255,255,0.1); 135 border: none !important; 136 border-left: 1px solid rgba(255,255,255,0.4) !important; 137 border-bottom: 1px solid rgba(255,255,255,0.2) !important; 138} 139 140.mean-container .mean-nav ul li a.mean-expand:hover { 141 background: rgba(0,0,0,0.9); 142} 143 144.mean-container .mean-push { 145 float: left; 146 width: 100%; 147 padding: 0; 148 margin: 0; 149 clear: both; 150} 151 152.mean-nav .wrapper { 153 width: 100%; 154 padding: 0; 155 margin: 0; 156} 157 158/* Fix for box sizing on Foundation Framework etc. */ 159.mean-container .mean-bar, .mean-container .mean-bar * { 160 -webkit-box-sizing: content-box; 161 -moz-box-sizing: content-box; 162 box-sizing: content-box; 163} 164 165 166.mean-remove { 167 display: none !important; 168}

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答2

0

ベストアンサー

以下のように行ってはいかがでしょうか?

HTML

1<!DOCTYPE html> 2<html lang="ja"> 3<head> 4 <meta charset="utf-8"> 5 <meta name="viewport" content="width=device-width, initial-scale=1.0"><!-- baneではなくname --> 6 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> 7 <link rel="stylesheet" href="https://cdn.jsdelivr.net/jquery.meanmenu/2.0.6/meanmenu.min.css"> 8 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> 9 <style type="text/css"> 10 .pc-menu > li, footer, section h2 { 11 text-align: center 12 } 13 14 body { 15 font-size: 14px; 16 font-family: Verdana, sans-serif; 17 margin: 0; 18 padding: 0; 19 color: #333; 20 background: #F2F2F2 21 } 22 23 p { 24 line-height: 2 25 } 26 27 .container { 28 width: 90%; 29 margin: 0 auto 30 } 31 32 .mobile-menu { 33 float: right; 34 font-size: 24px; 35 cursor: pointer 36 } 37 38 .pc-menu { 39 display: block; 40 list-style: none; 41 padding: 10px; 42 margin: 0; 43 float: right 44 } 45 46 .pc-menu > li { 47 display: inline-block; 48 width: 60px; 49 cursor: pointer 50 } 51 52 .sita img { 53 display: block; 54 height: 50px; 55 margin: 0 auto; 56 width: 50px 57 } 58 59 @media (max-width: 414px) { 60 .aburasoba, .pc-menu { 61 display: none 62 } 63 64 .features p { 65 width: 45% 66 } 67 68 .features img { 69 width: 50% 70 } 71 72 .right-side { 73 float: right; 74 padding-left: 5% 75 } 76 77 .left-side { 78 float: left; 79 padding-right: 5% 80 } 81 82 .features .item { 83 overflow: hidden 84 } 85 86 .news .container { 87 display: flex; 88 justify-content: space-between 89 } 90 91 .news .item { 92 width: 30% 93 } 94 95 .news .item img { 96 width: 100% 97 } 98 } 99 100 @media (min-width: 414px) { 101 .container { 102 width: 414px 103 } 104 105 .mobile-menu { 106 display: none 107 } 108 } 109 110 section { 111 padding: 60px 0 112 } 113 114 section:nth-child(even) { 115 background: #fff 116 } 117 118 .features img { 119 width: 100% 120 } 121 122 .features .item { 123 margin-bottom: 60px; 124 margin-left: 60px; 125 margin-right: 60px 126 } 127 128 .features .item:last-child, .news .item:last-child { 129 margin-bottom: 0 130 } 131 132 footer { 133 padding: 10px 0 134 } 135 136 /* 追加ここから */ 137 .mean-bar, .mean-nav { 138 background-color: #fff !important; 139 color: #000 !important; 140 } 141 142 .meanmenu-reveal { 143 color: #000 !important; 144 } 145 146 .meanmenu-reveal span { 147 background: #000 !important; 148 } 149 /* 追加ここまで */ 150 </style> 151 <title>RWD</title> 152</head> 153 154<body> 155<header> 156 157 <div class="container"> 158 <!-- <i class="fa fa-bars mobile-menu" aria-hidden="true"></i>--> 159 <ul class="pc-menu"> 160 <li>Menu</li> 161 <li>Menu</li> 162 <li>Menu</li> 163 </ul> 164 <h1 class="aburasoba">油そば池袋</h1> 165 </div> 166 167 <section class="features"><!--section1--> 168 <h2>Features</h2> 169 <div class="item"> 170 <img src="http://placehold.jp/3d4070/ffffff/150x150.png?text=img/feature.jpg"> 171 <p class="right-side">hello. hello. hello. hello. hello. hello. hello. 172 hello. hello. hello. hello. hello. hello. hello. hello. hello. </p> 173 </div> 174 175 <div class="item"> 176 <img src="http://placehold.jp/3d4070/ffffff/150x150.png?text=img/feature.jpg"> 177 <p class="left-side">hello. hello. hello. hello. hello. hello. hello. 178 hello. hello. hello. hello. hello. hello. hello. hello. hello. </p> 179 </div> 180 181 <div class="item"> 182 <img src="http://placehold.jp/3d4070/ffffff/150x150.png?text=img/feature.jpg"> 183 <p class="right-sidet">hello. hello. hello. hello. hello. hello. hello. 184 hello. hello. hello. hello. hello. hello. hello. hello. hello. </p> 185 </div> 186 </section> 187</header> 188<footer> 189 <div class="sita"> 190 <img src="http://placehold.jp/3d4070/ffffff/150x150.png?text=img/footer.png"> 191 </div> 192</footer> 193<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> 194<script src="https://cdn.jsdelivr.net/jquery.meanmenu/2.0.6/jquery.meanmenu.js"></script> 195<script> 196 $(function () { 197 $("div.container").meanmenu({}); 198 }); 199</script> 200</body> 201</html>

投稿2017/09/09 08:26

s8_chu

総合スコア14731

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

文字数がオーバーしてしまったのでこちらに記述します

jquery

1/*! 2* jQuery meanMenu v2.0.8 3* @Copyright (C) 2012-2014 Chris Wharton @ MeanThemes (https://github.com/meanthemes/meanMenu) 4* 5*/ 6/* 7* This program is free software: you can redistribute it and/or modify 8* it under the terms of the GNU General Public License as published by 9* the Free Software Foundation, either version 3 of the License, or 10* (at your option) any later version. 11* 12* THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT 13* HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, 14* INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR 15* FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE 16* OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, 17* COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.COPYRIGHT HOLDERS WILL NOT 18* BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL 19* DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION. 20* 21* You should have received a copy of the GNU General Public License 22* along with this program. If not, see <http://gnu.org/licenses/>. 23* 24* Find more information at http://www.meanthemes.com/plugins/meanmenu/ 25* 26*/ 27(function ($) { 28 "use strict"; 29 $.fn.meanmenu = function (options) { 30 var defaults = { 31 meanMenuTarget: jQuery(this), // Target the current HTML markup you wish to replace 32 meanMenuContainer: 'body', // Choose where meanmenu will be placed within the HTML 33 meanMenuClose: "X", // single character you want to represent the close menu button 34 meanMenuCloseSize: "18px", // set font size of close button 35 meanMenuOpen: "<span /><span /><span />", // text/markup you want when menu is closed 36 meanRevealPosition: "right", // left right or center positions 37 meanRevealPositionDistance: "0", // Tweak the position of the menu 38 meanRevealColour: "", // override CSS colours for the reveal background 39 meanScreenWidth: "480", // set the screen width you want meanmenu to kick in at 40 meanNavPush: "", // set a height here in px, em or % if you want to budge your layout now the navigation is missing. 41 meanShowChildren: true, // true to show children in the menu, false to hide them 42 meanExpandableChildren: true, // true to allow expand/collapse children 43 meanExpand: "+", // single character you want to represent the expand for ULs 44 meanContract: "-", // single character you want to represent the contract for ULs 45 meanRemoveAttrs: false, // true to remove classes and IDs, false to keep them 46 onePage: false, // set to true for one page sites 47 meanDisplay: "block", // override display method for table cell based layouts e.g. table-cell 48 removeElements: "" // set to hide page elements 49 }; 50 options = $.extend(defaults, options); 51 52 // get browser width 53 var currentWidth = window.innerWidth || document.documentElement.clientWidth; 54 55 return this.each(function () { 56 var meanMenu = options.meanMenuTarget; 57 var meanContainer = options.meanMenuContainer; 58 var meanMenuClose = options.meanMenuClose; 59 var meanMenuCloseSize = options.meanMenuCloseSize; 60 var meanMenuOpen = options.meanMenuOpen; 61 var meanRevealPosition = options.meanRevealPosition; 62 var meanRevealPositionDistance = options.meanRevealPositionDistance; 63 var meanRevealColour = options.meanRevealColour; 64 var meanScreenWidth = options.meanScreenWidth; 65 var meanNavPush = options.meanNavPush; 66 var meanRevealClass = ".meanmenu-reveal"; 67 var meanShowChildren = options.meanShowChildren; 68 var meanExpandableChildren = options.meanExpandableChildren; 69 var meanExpand = options.meanExpand; 70 var meanContract = options.meanContract; 71 var meanRemoveAttrs = options.meanRemoveAttrs; 72 var onePage = options.onePage; 73 var meanDisplay = options.meanDisplay; 74 var removeElements = options.removeElements; 75 76 //detect known mobile/tablet usage 77 var isMobile = false; 78 if ( (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)) || (navigator.userAgent.match(/Android/i)) || (navigator.userAgent.match(/Blackberry/i)) || (navigator.userAgent.match(/Windows Phone/i)) ) { 79 isMobile = true; 80 } 81 82 if ( (navigator.userAgent.match(/MSIE 8/i)) || (navigator.userAgent.match(/MSIE 7/i)) ) { 83 // add scrollbar for IE7 & 8 to stop breaking resize function on small content sites 84 jQuery('html').css("overflow-y" , "scroll"); 85 } 86 87 var meanRevealPos = ""; 88 var meanCentered = function() { 89 if (meanRevealPosition === "center") { 90 var newWidth = window.innerWidth || document.documentElement.clientWidth; 91 var meanCenter = ( (newWidth/2)-22 )+"px"; 92 meanRevealPos = "left:" + meanCenter + ";right:auto;";

投稿2017/09/08 15:05

sutosi

総合スコア27

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

sutosi

2017/09/08 15:05

続きです if (!isMobile) { jQuery('.meanmenu-reveal').css("left",meanCenter); } else { jQuery('.meanmenu-reveal').animate({ left: meanCenter }); } } }; var menuOn = false; var meanMenuExist = false; if (meanRevealPosition === "right") { meanRevealPos = "right:" + meanRevealPositionDistance + ";left:auto;"; } if (meanRevealPosition === "left") { meanRevealPos = "left:" + meanRevealPositionDistance + ";right:auto;"; } // run center function meanCentered(); // set all styles for mean-reveal var $navreveal = ""; var meanInner = function() { // get last class name if (jQuery($navreveal).is(".meanmenu-reveal.meanclose")) { $navreveal.html(meanMenuClose); } else { $navreveal.html(meanMenuOpen); } }; // re-instate original nav (and call this on window.width functions) var meanOriginal = function() { jQuery('.mean-bar,.mean-push').remove(); jQuery(meanContainer).removeClass("mean-container"); jQuery(meanMenu).css('display', meanDisplay); menuOn = false; meanMenuExist = false; jQuery(removeElements).removeClass('mean-remove'); }; // navigation reveal var showMeanMenu = function() { var meanStyles = "background:"+meanRevealColour+";color:"+meanRevealColour+";"+meanRevealPos; if (currentWidth <= meanScreenWidth) { jQuery(removeElements).addClass('mean-remove'); meanMenuExist = true; // add class to body so we don't need to worry about media queries here, all CSS is wrapped in '.mean-container' jQuery(meanContainer).addClass("mean-container"); jQuery('.mean-container').prepend('<div class="mean-bar"><a href="#nav" class="meanmenu-reveal" style="'+meanStyles+'">Show Navigation</a><nav class="mean-nav"></nav></div>'); //push meanMenu navigation into .mean-nav var meanMenuContents = jQuery(meanMenu).html(); jQuery('.mean-nav').html(meanMenuContents); // remove all classes from EVERYTHING inside meanmenu nav if(meanRemoveAttrs) { jQuery('nav.mean-nav ul, nav.mean-nav ul *').each(function() { // First check if this has mean-remove class if (jQuery(this).is('.mean-remove')) { jQuery(this).attr('class', 'mean-remove'); } else { jQuery(this).removeAttr("class"); } jQuery(this).removeAttr("id"); }); } // push in a holder div (this can be used if removal of nav is causing layout issues) jQuery(meanMenu).before('<div class="mean-push" />'); jQuery('.mean-push').css("margin-top",meanNavPush); // hide current navigation and reveal mean nav link jQuery(meanMenu).hide(); jQuery(".meanmenu-reveal").show(); // turn 'X' on or off jQuery(meanRevealClass).html(meanMenuOpen); $navreveal = jQuery(meanRevealClass); //hide mean-nav ul jQuery('.mean-nav ul').hide(); // hide sub nav if(meanShowChildren) { // allow expandable sub nav(s) if(meanExpandableChildren){ jQuery('.mean-nav ul ul').each(function() { if(jQuery(this).children().length){ jQuery(this,'li:first').parent().append('<a class="mean-expand" href="#" style="font-size: '+ meanMenuCloseSize +'">'+ meanExpand +'</a>'); } }); jQuery('.mean-expand').on("click",function(e){ e.preventDefault(); if (jQuery(this).hasClass("mean-clicked")) { jQuery(this).text(meanExpand); jQuery(this).prev('ul').slideUp(300, function(){}); } else { jQuery(this).text(meanContract); jQuery(this).prev('ul').slideDown(300, function(){}); } jQuery(this).toggleClass("mean-clicked"); }); } else { jQuery('.mean-nav ul ul').show(); } } else { jQuery('.mean-nav ul ul').hide(); } // add last class to tidy up borders jQuery('.mean-nav ul li').last().addClass('mean-last'); $navreveal.removeClass("meanclose"); jQuery($navreveal).click(function(e){ e.preventDefault(); if( menuOn === false ) { $navreveal.css("text-align", "center"); $navreveal.css("text-indent", "0"); $navreveal.css("font-size", meanMenuCloseSize); jQuery('.mean-nav ul:first').slideDown(); menuOn = true; } else { jQuery('.mean-nav ul:first').slideUp(); menuOn = false; } $navreveal.toggleClass("meanclose"); meanInner(); jQuery(removeElements).addClass('mean-remove'); }); // for one page websites, reset all variables... if ( onePage ) { jQuery('.mean-nav ul > li > a:first-child').on( "click" , function () { jQuery('.mean-nav ul:first').slideUp(); menuOn = false; jQuery($navreveal).toggleClass("meanclose").html(meanMenuOpen); }); } } else { meanOriginal(); } }; if (!isMobile) { // reset menu on resize above meanScreenWidth jQuery(window).resize(function () { currentWidth = window.innerWidth || document.documentElement.clientWidth; if (currentWidth > meanScreenWidth) { meanOriginal(); } else { meanOriginal(); } if (currentWidth <= meanScreenWidth) { showMeanMenu(); meanCentered(); } else { meanOriginal(); } }); } jQuery(window).resize(function () { // get browser width currentWidth = window.innerWidth || document.documentElement.clientWidth; if (!isMobile) { meanOriginal(); if (currentWidth <= meanScreenWidth) { showMeanMenu(); meanCentered(); } } else { meanCentered(); if (currentWidth <= meanScreenWidth) { if (meanMenuExist === false) { showMeanMenu(); } } else { meanOriginal(); } } }); // run main menuMenu function on load showMeanMenu(); }); }; })(jQuery); ```
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問