麻烦大神看看这个为什么没有3D效果

<!DOCTYPE html>

<html>

<head>

<title>练习</title>

<style type="text/css">

#box{perspective: 500;

perspective-origin: 50% 50%;

transform-style: preserve-3d;

width: 500px;

height: 500px;}


.page{text-align: center;

font-size: 100px;

height: 300px;

width: 300px;

line-height: 300px;

margin: 100px;

position: absolute;

transition: transform 2s;

background: #ccc;

transform-origin: bottom;}

#page6,#page2,#page3,#page4,#page5{

transform: rotateX(90deg);

}

</style>

</head>

<body>

<div id="box">

<div class="page" id="page1">1</div>

<div class="page" id="page2">2</div>

<div class="page" id="page3">3</div>

<div class="page" id="page4">4</div>

<div class="page" id="page5">5</div>

<div class="page" id="page6">6</div>

</div>

<div id="btn">

<button id="pre">pre</button>

<button id="next">next</button>

</div>

<script type="text/javascript">

var next=document.getElementById('next');

var curIndex=1;

next.onclick=function(){

if (curIndex==6) {return;}

var curPage=document.getElementById('page'+curIndex);

curPage.style.transform="rotateX(-90deg)";

curIndex++;

var curPage=document.getElementById('page'+curIndex);

curPage.style.transform="rotateX(0)";

}

pre.onclick=function(){

if (curIndex==1) {return;}

var curPage=document.getElementById('page'+curIndex);

curPage.style.transform="rotateX(-90deg)";

curIndex--;

var curPage=document.getElementById('page'+curIndex);

curPage.style.transform="rotateX(0)";

}


</script>

</body>

</html>


慕哥6327088
浏览 1251回答 2
2回答

无敌大熊熊

你为什么能邀请我??

Doit的信仰

只有2d的
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

CSS3