我正在使用JQuery .animate()函数来滑动容器div中的div.这在谷歌浏览器中没有问题,但是当我尝试使用Firefox或IE时,div会变成乱码并且实际上不会滑动.我是Javascript的新手并且在浏览器兼容性方面一无所知,有人能指出我正确的方向吗?这是相关代码:
HTML
<div id="slider">
<div id="main" class="content">
</div>
<div id="projects" class="content">
</div>
<div id="about" class="content">
</div>
<div id="contact" class="content">
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS
#slider {
width: 100px;
height: 100px;
overflow: hidden;
position: relative;
}
#main {
background-color: red;
width: inherit;
height: inherit;
position: absolute;
}
#projects {
background-color: blue;
width: inherit;
height: inherit;
position: absolute;
}
#about {
background-color: yellow;
width: inherit;
height: inherit;
position: absolute;
}
#contact {
background-color: green;
width: inherit;
height: inherit;
position: absolute;
}
.content { …Run Code Online (Sandbox Code Playgroud)