为了账号安全,请及时绑定邮箱和手机立即绑定

为什么我的代码没任何效果,能翻页但没有3D效果

<!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>

正在回答

1 回答

js问题。 onclick=function(){  → onclick=function(e){     ;然后css的问题再仔细看下

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

为什么我的代码没任何效果,能翻页但没有3D效果

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信