【发布时间】:2014-05-11 19:28:02
【问题描述】:
我看过一些幻灯片,比如 http://slides.html5rocks.com 和 http://www.htmlfivewow.com
当您按左键或右键时,您会看到滑动立方体效果。 我想用这些效果制作简单的网页,只有几个div。我试图从源代码中获取 css 和 javascript,但幻灯片无法正常工作。
- 制作动画时,div 没有 3D 样式,它只是移动和旋转。事实上,http://slides.html5rocks.com 在我的 Firefox 中没有 3D 效果,而在 Chrome 中有。
- 有教程吗?
- 如何在 IE 10 中工作?
这是我的一些代码: html:
<div class="container">
<div id="div1" class="main slide current"> ... </div>
<div id="div2" class="main slide future"> ... </div>
<div id="div3" class="main slide future"> ... </div>
</div>
css:
.container {
height: 100%;
margin-left:auto;
margin-right:auto;
width:800px;
overflow: visible;
visibility: visible;
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
transform-style: preserve-3d;
}
.main{
border: 1px solid;
border-color: white;
border-radius: 15px 15px 0 0 ;
width: 100%;
min-height: 450px;
text-align: center;
padding: 5px;
}
.slide {
width: 800px;
height: 450px;
-webkit-transition: -webkit-transform 0.8s ease-in-out, opacity 1.2s ease-in-out;
-moz-transition: -moz-transform 0.8s ease-in-out, opacity 1.2s ease-in-out;
-webkit-box-orient: vertical;
-moz-box-orient: vertical;
box-orient: vertical;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
overflow: hidden;
display: none;
position: absolute;
}
.slide.past {
z-index: 8;
visibility: visible;
display: block;
opacity: 0;
-webkit-transform: translateZ(-400px) rotateY(-90deg) translateZ(400px);
-moz-transform: translateZ(-400px) rotateY(-90deg) translateZ(400px);
-o-transform: translateZ(-400px) rotateY(-90deg) translateZ(6400px);
transform: translateZ(-400px) rotateY(-90deg) translateZ(400px);
}
.slide.current {
z-index: 9;
visibility: visible;
display: block;
opacity: 1;
-webkit-transform: translateZ(-400px) rotateY(0deg) translateZ(400px);
-moz-transform: translateZ(-400px) rotateY(0deg) translateZ(400px);
-o-transform: translateZ(-400px) rotateY(0deg) translateZ(400px);
transform: translateZ(-400px) rotateY(0deg) translateZ(400px);
}
.slide.future {
z-index: 8;
visibility: visible;
display: block;
opacity: 0;
-webkit-transform: translateZ(-400px) rotateY(90deg) translateZ(400px);
-moz-transform: translateZ(-400px) rotateY(90deg) translateZ(400px);
-o-transform: translateZ(-400px) rotateY(90deg) translateZ(400px);
transform: translateZ(-400px) rotateY(90deg) translateZ(400px);
}
脚本:
$("#div1").attr("class", "main slide future");
$("#div2").attr("class", "main slide current");
【问题讨论】:
标签: javascript css html