1-----6翻对的,6---1翻页,没翻一页总会回到最后一页?
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style>
#my3dspace {
-webkit-perspective: 800;
-webkit-perspective-origin: 50% 50%;
overflow: hidden;
/* overflow:hidden;
}
#page {
width: 400px;
height: 400px;
margin: 0 auto;
/*采用3d效果*/
-webkit-transform-style: preserve-3d;
position: relative;
/* position:relative;
}
.page {
width: 360px;
height: 360px;
padding: 20px;
font-weight:bold;
line-height:360px;
background-color: #000;
color: #fff;
text-align: center;
font-size: 360px;
font-family: 'Adobe Heiti Std';
position: absolute;
}
#page1 {
-webkit-transform-origin: bottom;
-webkit-transition: -webkit-transform 1s linear;
}
#page2, #page3, #page4, #page5, #page6 {
-webkit-transform-origin: bottom;
-webkit-transition: -webkit-transform 1s linear;
-webkit-transform: rotateX(90deg);
}
#op {
text-align: center;
margin: 0 auto;
}
</style>
<script>
var curindex = 1;
function next() {
if (curindex == 6)
return;
var cutpage = document.getElementById("page" + curindex);
cutpage.style.transform = "rotateX(-90deg)";
curindex++;
var nextpage = document.getElementById("page" + curindex);
nextpage.style.transform = "rotateX(0deg)";
}
function pre() {
if (curindex == 1)
return;
var cutpage = document.getElementById("page" + curindex);
cutpage.style.webkitTransform = "rotaeX(90deg)";
curindex--;
var prepage = document.getElementById("page" + curindex);
prepage.style.webkitTransform = "rotateX(0deg)";
}
</script>
</head>
<body>
<div id="my3dspace">
<div id="page">
<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>
<div id="op">
<a href="javascript:next()">next</a>
<a href="javascript:pre()">pre</a>
</div>
</body>
</html>