我之前看到过这个问题,但是我在修复网站时遇到了问题。我正在构建一个投资组合网站,并添加了使用:hover
和CSS转换的导航元素。我一直在浏览器上测试该网站,虽然它在桌面浏览器中运行良好,但移动版Safari拒绝合作(点击鼠标悬停在移动Chrome和移动IE中运行良好)。在iPhone或iPad上,导航完全失效。如果有人能帮忙,我将非常感激。网站是:www.gabeweintraub.com。相关代码如下:
(注意:这是我的第一个网络项目,所以我认为除了这个之外,代码中还有一堆令人尴尬的漏洞问题。请温柔,请。)
HTML
<div class="splash_nav">
<ul>
<li><span>Ideas</span>
<ul>
<li><a href="/cgi-bin/blosxom.cgi">Blog</a></li>
<li><a href="http://twitter.com/GabeWeintraub">Twitter</a></li>
</ul>
</li>
<li><span>Projects</span>
<ul>
<li><a href="/gallery.html" >Art</a></li>
<li><a href="/code.html" >Code</a></li>
</ul>
</li>
<li><span>About</span>
<ul>
<li><a href="/bio.html">Bio</a></li>
<li><a href="/resume.html">Resume</a></li>
<li><a href="/contact.html">Contact</a></li>
</ul>
</li>
</ul>
</div>
</div>
<nav>
<div class="menu-item-2">
<h4>Ideas</h4>
<ul>
<li><a href="/cgi-bin/blosxom.cgi">Blog</a></li>
<li><a href="http://twitter.com/GabeWeintraub">Twitter</a></li>
</ul>
</div>
<div class="menu-item-2">
<h4>Projects</h4>
<ul>
<li><a href="/gallery.html">Art</a></li>
<li><a href="/code.html">Code</a></li>
</ul>
</div>
<div class="menu-item-3">
<h4>About</h4>
<ul>
<li><a href="/bio.html">Bio</a></li>
<li><a href="/resume.html">Resume</a></li>
<li><a href="/contact.html">Contact</a></li>
</ul>
</div>
</nav>
CSS
.splash_nav {
width: 500px;
position: relative;
top: 300px;
margin: 0 auto 2em;
padding: 0;
text-align: center;
}
.splash_nav li {
display: inline;
list-style: none;
}
.splash_nav li span {
display: inline;
list-style: none;
text-transform: uppercase;
text-decoration: none;
color: rgb(152,27,30);
font-size: 1.5em;
font-weight: 500;
height: 100px;
padding: 10px;
}
.splash_nav li a {
display: inline;
text-transform: uppercase;
text-decoration: none;
color: rgb(152,27,30);
font-weight: 500;
height: 100px;
}
.splash_nav li ul {
display: none;
}
.splash_nav li:hover ul, .splash_nav li.hover ul {
position: fixed;
display: block;
height: 80px;
width: 500px;
top: 340px;
margin: 0 auto 0;
text-align: center;
}
.splash_nav li:hover li, .splash_nav li.hover li {
position: relative;
-webkit-animation: fadeIn 2s;
-moz-animation: fadeIn 2s;
-ms-animation: fadeIn 2s;
}
.splash_nav li:hover li a, .splash_nav li.hover li a {
color: rgb(76,77,79);
font-size: 1em;
padding: 10px;
}
.splash_nav li li a:hover {
background: #eee;
}
@-webkit-keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
@-moz-keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
@-ms-keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
nav {
float: right;
line-height: 1.5;
padding-right: 70px;
}
.menu-item-1, .menu-item-2, .menu-item-3 {
background: #fff;
}
.menu-item-1 h4, .menu-item-2 h4, .menu-item-3 h4 {
color: rgb(152,27,30);
font-size: 1.5em;
font-weight: 500;
text-align: right;
}
.menu-item-1 h4 a, .menu-item-2 h4 a, .menu-item-3 h4 a {
color: rgb(152,27,30);
display: block;
text-decoration: none;
text-align: right;
text-transform: uppercase;
}
/*ul Styles*/
.menu-item-2 ul, .menu-item-3 ul {
background: #fff;
font-size: 1em;
line-height: 30px;
height: 0px;
list-style-type: none;
overflow: hidden;
text-transform: uppercase;
/*Animation*/
-webkit-transition: height 1.5s ease;
-moz-transition: height 1.5s ease;
-o-transition: height 1.5s ease;
-ms-transition: height 1.5s ease;
transition: height 1.5s ease;
}
.menu-item-3:hover ul {
height: 93px;
}
.menu-item-2:hover ul{
height: 62px;
}
.menu-item-2 ul a, .menu-item-3 ul a {
width: 150px;
text-decoration: none;
color: rgb(76,77,79);
display: block;
text-align: right;
padding-right: 20px;
}
/*li Styles*/
.menu-item-2 li, .menu-item-3 li {
border-bottom: 1px solid color: rgb(76,77,79);;
text-align: right;
}
.menu-item-2 li:hover, .menu-item-3 li:hover {
background: #eee;
text-align: right;
text-decoration: none;
}
谢谢!