求源代码呀,怎么敲都
求源代码呀 怎么敲都不对
求源代码呀 怎么敲都不对
2016-11-09
当然,你也可以使用我的代码
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>CSS3 创建翻页效果</title> <style type="text/css"> .wrap { -webkit-perspective: 800; -webkit-perspective-origin: center; overflow: hidden; } .wrapContent { width: 400px; height: 400px; margin: 0 auto; position: relative; -webkit-transform-style: preserve-3d; } .pages { width: 400px; height: 400px; position: absolute; top: 0; left: 0; font-size: 400px; font-weight: bold; line-height: 400px; text-align: center; color: #fff; background-color: #69e; -webkit-transform-origin: bottom; -webkit-transform: rotateX(90deg); -webkit-transition: -webkit-transform 1s linear; } .page1 { -webkit-transform: rotateX(0deg); } .controller { margin: 10px auto; text-align: center; } .controller span { width: 80px; height: 30px; line-height: 30px; border: 1px solid #ccc; margin-right: 10px; display: inline-block; cursor: pointer; } </style> </head> <body> <div> <div> <div class="pages page1">1</div> <div class="pages page2">2</div> <div class="pages page3">3</div> <div class="pages page4">4</div> <div class="pages page5">5</div> <div class="pages page6">6</div> </div> </div> <div> <span id="next" onclick="next();">next</span> <span id="previous" onclick="previous();">previous</span> </div> <script type="text/javascript"> var curIndex =1; function next() { if(curIndex == 6) { return; }else { var curPage = document.getElementsByClassName("page" + curIndex); curPage[0].style.webkitTransform = 'rotateX(-90deg)'; curIndex ++; var nextPage = document.getElementsByClassName("page" + curIndex); nextPage[0].style.webkitTransform = 'rotateX(0deg)'; } } function previous() { if(curIndex == 1) { return; }else { var curPage = document.getElementsByClassName("page" + curIndex); curPage[0].style.webkitTransform = 'rotateX(90deg)'; curIndex --; var nextPage = document.getElementsByClassName('page' + curIndex); nextPage[0].style.webkitTransform = 'rotateX(0deg)'; } } </script> </body> </html>
举报