【发布时间】:2013-11-15 11:42:35
【问题描述】:
我有一个基于我之前工作的问题。
我正在构建一个响应式导航。
问题发生的时候,
按灰色块打开导航 - 工作正常。 按灰色块隐藏导航 - 工作正常
但是,一旦您隐藏导航并将屏幕尺寸增加到超过 800 像素,主导航仍然隐藏,它不会再次出现。
任何机构都可以帮助解决这个问题吗?
body {
font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;
color: #444;
font-size: 62.5%;
text-rendering: optimizeLegibility;
}
#wrap {
margin: 0 auto;
text-align: center;
overflow: hidden;
}
#wrap-inner {
padding: 20px;
padding-top:80px;
border: 1px solid blue;
}
#wrap-inner-profile {
padding: 10px 20px 20px 20px;
}
#content {
position: relative;
max-width: 970px;
margin: 0 auto;
padding: 0;
font-size: 1.2em;
border: 1px solid green;
}
li {
list-style: none;
}
a:link, a:visited {
color: #4083a9;
outline: none;
text-decoration: none;
font-size: 13px;
}
a:hover {
text-decoration: none;
color: #205f82;
}
ul, ol, h1, h2, h3, h4, p {
padding: 0px;
margin: 0px;
;
}
p {
line-height: 22px;
font-size: 13px;
}
.clearfix {
clear: both;
}
img:hover {
opacity: .7;
}
/* =============================================================================
HEADER
========================================================================== */
#header {
width: 100%;
height: 67px;
background: white;
z-index: 9997;
position: fixed;
top: 0px;
-webkit-box-shadow: rgba(6, 8, 8, 0.0980392) 0px 3px 3px;
box-shadow: rgba(6, 8, 8, 0.0980392) 0px 3px 3px;
}
#header-inner {
position: relative;
margin: 0 auto;
padding: 0 12px;
max-width: 970px;
}
#logo {
float: left;
padding: 0px 20px 0 0;
}
#logo a {
display: block;
width: 107px;
height: 50px;
background-repeat: no-repeat;
background-position: 0 50%;
background-image: url(../img/home/oh-holla.png);
-webkit-transition: opacity 0.2s ease;
-moz-transition: opacity 0.2s ease;
-o-transition: opacity 0.2s ease;
transition: opacity 0.2s ease;
}
#logo img {
height: 0;
}
#logo a:hover {
opacity: .6;
}
#nav {
margin: 1px 0px 0 0px;
color: #777;
padding:0px;
float:right;
}
#nav>li {
float: right;
font-size: 1.25em;
line-height: 1;
margin-left: 30px;
}
#nav>li>a {
display: block;
height: 66px;
line-height: 66px;
text-decoration: none;
color: #333;
font-weight: bold;
}
#toggle-nav {
display: none;
}
#right-nav {
margin: 1px 0px 0 0px;
color: #777;
padding:0px;
float:right;
margin-top: 26px;
}
#right-nav li {
float: right;
font-size: 1.25em;
line-height: 1;
margin-left: 30px;
}
#right-nav li a {
display: block;
height: 66px;
line-height: 66px;
text-decoration: none;
color: #333;
font-weight: bold;
}
#signin {
border:1px solid #ddd;
padding: 10px 20px;
color: #333;
font-weight: bold;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
}
#login {
padding: 10px 20px;
color: #333;
font-weight: bold;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
margin-left: 100px;
}
/* =============================================================================
NAVIGATION MEDIA MAX 800PX
========================================================================== */
@media screen and (max-width: 800px) {
#header {
position: fixed;
height: 57px;
-webkit-box-shadow: rgba(6, 8, 8, 0.0980392) 0px 3px 3px;
box-shadow: rgba(6, 8, 8, 0.0980392) 0px 3px 3px;
background: green;
}
#toggle-nav {
position: absolute;
top: 0px;
left: 0px;
display: block;
width: 48px;
height: 40px;
text-indent: -9999px;
background: url('../img/home/burger-menu.png') 20px 20px no-repeat;
opacity: .5;
background:black;
}
#logo a {
display: block;
height: 40px;
margin: 0 auto 0 auto;
}
#logo {
float: none;
padding-right: 0;
text-align: left;
}
#nav {
width: 100%;
margin: 0 0 10px 0;
text-align: left;
position: absolute;
top: 57px;
display: none;
}
#nav li {
position: relative;
float: none;
margin-right: 0;
text-align: left;
font-size: 12px;
background: #323232;
margin-left: 0px;
}
#nav li:hover {
background: #2e2e2e;
}
#header-inner {
width: auto;
padding: 0;
height: 57px;
background: pink;
}
#nav li a {
height: auto;
padding: 15px;
font-size: 14px;
font-weight: bold;
line-height: 1;
border-bottom: 1px solid black;
background: white;
}
#wrap-inner {
padding-top: 60px;
}
#right-nav {
display: block;
float: none;
position: absolute;
top: -10px;
right: 20px;
background: none;
}
#livefeed {
-webkit-box-shadow: rgba(6, 8, 8, 0.0980392) 0px 3px 3px;
box-shadow: rgba(6, 8, 8, 0.0980392) 0px 3px 3px;
}
}
【问题讨论】:
-
你的 css 的问题.. 小于 800px 的媒体的 css 很好.. 但 css 不少于不好.. 你把
#toggle-nav { display: none; }这就是为什么它不工作.. 只是检查下面的小提琴.. http://jsfiddle.net/9jPe9/3/ -
嗨,这不起作用?
-
我只应用了toggle-nav的样式..从媒体css添加所有必要的样式后尝试..
-
你的小提琴..http://jsfiddle.net/9jPe9/4/..
标签: jquery html css navigation responsive-design