<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>3D</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
<!-- <script type="text/javascript" src="jquery.js"></script> -->
<!-- <script type="text/javascript" src="3D.js"></script> -->
<style>
.pagegroup{
width: 100%;
-webkit-perspective:800;
/* -moz-perspective:800; */
perspective:800;
-webkit-perspective-origin:center center;
-moz-perspective-origin:center center;
perspective-origin:center center;
overflow: hidden;
}
.pagegroup{
width: 400px;
height: 450px;
margin:50px auto;
-webkit-transform-style:preserve-3d;
-moz-transform-style:preserve-3d;
transform-style:preserve-3d;
position: relative;
}
.page{
width: 400px;
height: 450px;
margin:50px auto;
background-color: #000;
color: #fff;
font-size: 360px;
font-weight: bold;
text-align: center;
line-height: 450px;
position: absolute;
-webkit-transform-origin:bottom;
-moz-transform-origin:bottom;
transform-origin:bottom;
-webkit-transition:-webkit-transform 1.5s linear;
-moz-transition:-moz-transform 1.5s linear;
transition:-moz-transform 1.5s linear;
}
#page1,#page2,#page3,#page4,#page5,#page6{
-webkit-transform:rotateX(90deg);
-moz-transform:rotateX(90deg);
transform:rotateX(90deg);
z-index: 1;
}
#page0{
-webkit-transform:-webkit-rotateX(0deg);
-moz-transform:-moz-rotateX(0deg);
transform:-moz-rotateX(0deg);
z-index: 0;
}
.turning{
width: 400px;
margin:0 auto;
}
.turning span{
width: 400px;
margin:0 auto;
cursor: pointer;
}
</style>
</head>
<body>
<div class="wrap">
<div class="pagegroup">
<div class="page" id="page0">1</div>
<div class="page" id="page1">2</div>
<div class="page" id="page2">3</div>
<div class="page" id="page3">4</div>
<div class="page" id="page4">5</div>
<div class="page" id="page5">6</div>
<div class="page" id="page6">7</div>
</div>
</div>
<div class="turning">
<span id="pre">上一页</span>
<span id="next">下一页</span>
</div>
<script>
var pre=document.getElementById('pre');
var next=document.getElementById('next');
var currentnum=0;
next.onclick=function(){
if(currentnum==6)
return;
var currentpage=document.getElementById("page"+currentnum);
currentpage.style.webkitTransform="rotateX(-90deg)";
currentnum++;
var nextpage=document.getElementById("page"+currentnum);
nextpage.style.webkitTransform="rotateX(0deg)";
};
pre.onclick=function(){
if(currentnum==0)
return;
var currentpage=document.getElementById("page"+currentnum);
currentpage.style.webkitTransform="rotate(90deg)";
currentnum--;
var prepage=document.getElementById("page"+currentnum);
prepage.style.webkitTransform="rotateX(0deg)";
}
</script>
</body>
</html>
js问题。 onclick=function(){ → onclick=function(e){ ;然后css的问题再仔细看下