我正在为移动网站<nav>
工作。它是Firefox和Chrome中的工作文件,但不适用于Safari。我在Windows 8.1上运行它,我在iPad mini上的Safari上观察到同样的问题。
在下面的代码段中,如果您查看移动视图(max-width: 768px
)并点击右上角的菜单图标,该图标就会设置为十字(X)图标的动画,同样也是导航菜单假设向下滑动。
$("a.nav-opener").click(function(e) {
e.preventDefault();
$('body').toggleClass("nav-active");
});
&#13;
@media screen and (max-width: 768px){
.holder {
padding: 14px;
}
.logo {
float: none;
display: block;
margin: 0px auto;
width: 168px;
position: relative;
z-index: 2;
}
a {
text-decoration: none;
color: #DC7952;
outline: medium none;
}
.logo img {
width: 100%;
height: auto;
display: block;
}
img {
max-width: 100%;
height: auto;
}
.nav-opener {
display: block;
position: absolute;
top: 0px;
right: 0px;
border-left: 1px solid #D4D4D4;
width: 65px;
height: 53px;
text-indent: -9999px;
overflow: hidden;
background: none repeat scroll 0% 0% transparent;
z-index: 15;
}
.nav-opener::before, .nav-opener::after {
content: "";
top: 19px;
}
.nav-opener::before, .nav-opener::after, .nav-opener span {
background: none repeat scroll 0% 0% #DC7952;
position: absolute;
left: 15%;
right: 15%;
height: 6px;
margin-top: -2px;
transition: all 0.2s linear 0s;
}
.nav-opener::after {
top: 37px;
}
.nav-opener span {
background: none repeat scroll 0% 0% #DC7952;
position: absolute;
top: 28px;
left: 15%;
right: 15%;
height: 6px;
margin-top: -2px;
transition: all 0.2s linear 0s;
}
.nav-active .nav-opener::after, .nav-active .nav-opener::before {
transform: rotate(45deg);
border-radius: 3px;
top: 24px;
left: 15%;
right: 15%;
}
.nav-active .nav-opener::after {
transform: rotate(-45deg);
}
.nav-opener::before, .nav-opener::after {
content: "";
}
.nav-active .nav-opener span {
display: none;
}
.navigation-container {
border: 0px none;
overflow: hidden;
position: absolute;
top: 53px;
left: 0px;
right: 0px;
z-index: 999;
max-height: 0px;
transition: all 0.25s linear 0s;
margin: 0px;
padding: 0px;
}
.nav-active .navigation-container {
max-height: 4000px;
}
.navigation-container .drop {
transition: all 0.25s linear 0s;
transform: translateY(-100%);
background: none repeat scroll 0% 0% #FFF;
width: 100%;
display: table;
}
.nav-active .drop {
transform: translateY(0px);
}
#nav {
margin: 0px;
overflow: visible;
font-size: 24px;
display: table-header-group;
font-family: "apercu",sans-serif;
font-weight: 700;
line-height: 1.4285;
text-transform: uppercase;
}
#nav ul {
display: block;
border-top: 1px solid #E8E8E8;
padding: 0px;
width: 100%;
margin: 0px;
}
#nav li {
display: block;
width: auto;
border-style: solid;
border-color: #E8E8E8;
-moz-border-top-colors: none;
-moz-border-right-colors: none;
-moz-border-bottom-colors: none;
-moz-border-left-colors: none;
border-image: none;
border-width: 0px 0px 1px;
list-style: outside none none;
}
#nav li.active a, #nav li a:hover {
text-decoration: none;
color: #FFF;
background: none repeat scroll 0% 0% #DC7952;
}
#nav a {
display: block;
text-align: left;
padding: 15px 20px;
}
}
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="holder">
<strong class="logo"><a href="#">Some logo</a></strong>
</div>
<!-- navigation opener -->
<a href="#" class="nav-opener"><span>opener</span></a>
<div class="navigation-container">
<div class="drop">
<!-- main navigation of the page -->
<nav id="nav">
<ul>
<li class="active"><a href="#">HOME</a></li>
<li><a href="#">BIBLE RESOURCES</a></li>
<li><a href="#">OUR MISSION</a></li>
</ul>
</nav>
</div>
</div>
&#13;
有人能指出我正确的方向吗?
答案 0 :(得分:5)
转换和转换不适用于safari和chrome,而不使用浏览器提供的webkit for safari所以使用:
-webkit-transform和-webkit-transition代替......
答案 1 :(得分:0)
转换属性需要在safari中加前缀
例如:-webkit-transform
用于任何其他资源检查this
答案 2 :(得分:0)
Apple早在2007年就停止发布Safari的最新版本。可能是您使用与CSS3不兼容的旧Safari浏览器。
Chrome和最新的Safari可以在webkit渲染引擎上运行..如果它在chrome中运行,那么它在safari上的工作方式也一样。
支持转换的Safari版本:
http://caniuse.com/#feat=transforms2d
如果我错了,请纠正我:)