以下是 HTML5实现3D翻页电子书特效 的示例演示效果:
部分效果截图:
HTML代码(index.html):
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML5实现3D翻页电子书特效 </title>
<!--可无视-->
<link rel="stylesheet" type="text/css" href="css/normalize.css" />
<link rel="stylesheet" type="text/css" href="css/zzsc-demo.css">
<!--必要样式-->
<style type="text/css">
html,body{width:100%;margin:0px;padding:0px;background:#e0604a url('i/bg2.jpg');color:#000000;min-width:800px;}
body * { -webkit-tap-highlight-color: rgba(0,0,0,0); }
.links a:link,.links a:visited{color:black;text-decoration:none;font:20px sans-serif;}
.links a:hover{color:black;text-decoration:underline;}
.red {border:1px solid #ffc30d;}
.red-filled {background:#e0604a;border:1px solid #ffc30d;}
.blue {background:#67BCCF;}
.section {width:800px;border-radius:10px; margin:50px auto;}
.section p{text-align:center;margin:0px;padding:20px;font:16px sans-serif;line-height:140%;}
.section p strong {color:gold;}
.section-list {width:800px;border-radius:10px;margin:50px auto;}
.address{margin:0px auto 50px auto;padding:0px;width:800px;text-align:center;}
.address, .address a{font:16px arial, sans-serif;color:black;}
</style>
</head>
<body>
<div class="zzsc-container">
<div class="zzsc-demo center">
<a href="index.html" class="current">DEMO1</a>
<a href="index2.html">DEMO2</a>
</div>
<div class="section blue">
</div>
<div class="section red">
<div style="padding:30px;">
<div id="photobook" style="height:100px;"></div>
</div>
</div>
<div class="section-list blue">
<div style="padding:30px;" class="links">
<p><a href="#"><strong>1. Example,</strong> language (italian), </a></p>
<p><a href="#"><strong>2. Example,</strong> border (100), pageColor:(green), image on background</a></p>
<p><a href="#"><strong>3. Example,</strong> border (10), slope(1), startPage(4), flip (basic) </a></p>
</div>
</div>
<div class="section red-filled">
<p style="line-height:160%;">Use option <strong>‘cesh:false’</strong> while you are testing your book and <strong>‘cesh:true’</strong> (by default) in web.<br>
Minimal width of parent element for book is <strong>266 px.</strong> After that the book will be hidden.</p>
</div>
</div>
<script src="js/jquery-1.11.0.min.js" type="text/javascript"></script>
<script type="text/javascript" src="js/jquery.mousewheel.min.js"></script>
<script type="text/javascript" src="js/three.min.js"></script>
<script type="text/javascript" src="js/jquery.onebook3d-2.3.0-full-min.js"></script>
<script type="text/javascript">
$(function(){
var src1 = [
'ga02/001.jpg',
'ga02/002.jpg', 'ga02/003.jpg',
'ga02/004.jpg', 'ga02/005.jpg',
'ga02/006.jpg', 'ga02/007.jpg',
'ga02/008.jpg', 'ga02/009.jpg',
'ga02/010.jpg', 'ga02/011.jpg',
'ga02/012.jpg'
];
var src3 = [
['ga04/001.jpg','Title 1'],
['ga04/002.jpg','Title 2'], ['ga04/003.jpg','Title 3'],
['ga04/004.jpg','Title 4'], ['ga04/005.jpg','Title 5'],
['ga04/006.jpg','Title 6'], ['ga04/007.jpg','Title 7'],
['ga04/008.jpg','Title 8'], ['ga04/009.jpg','Title 9'],
['ga04/010.jpg','TItle 10']
];
var src4 = [
'ga04/001.jpg',
'ga04/002.jpg', 'ga04/003.jpg',
'ga04/004.jpg', 'ga04/005.jpg',
'ga04/006.jpg', 'ga04/007.jpg',
'ga04/008.jpg', 'ga04/009.jpg',
'ga04/010.jpg'
];
$('#photobook').onebook(src1,{skin:['light','dark'], bgDark:'#56998c url(i/bg.jpg)',bgLight:'#d97f6f url(i/bg2.jpg)', border:0, cesh:false});
$('.links a:eq(0)').click(function(){
$.onebook(src4,{language:'it'});
return false;
});
$('.links a:eq(1)').click(function(){
$.onebook(src4,{border:100, skin:'light', pageColor:'#60baaa', bgLight:'#56998c url(i/bg.jpg)', cesh:false});
return false;
});
$('.links a:eq(2)').click(function(){
$.onebook(src3,{slope:1, skin:'dark', startPage:4, border:10, flip:'basic', cesh:false});
return false;
});
});
</script>
</body>
</html>
HTML代码(index2.html):
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML5实现3D翻页电子书特效</title>
<!--可无视-->
<link rel="stylesheet" type="text/css" href="css/normalize.css" />
<link rel="stylesheet" type="text/css" href="css/zzsc-demo.css">
<!--必要样式-->
<style type="text/css">
html,body{width:100%;margin:0px;padding:0px;background:#e0604a url('i/bg2.jpg');color:#000000;min-width:800px;}
body * { -webkit-tap-highlight-color: rgba(0,0,0,0); }
.links a:link,.links a:visited{color:black;text-decoration:none;font:20px sans-serif;}
.links a:hover{color:black;text-decoration:underline;}
.red {border:1px solid #ffc30d;}
.red-filled {background:#e0604a;border:1px solid #ffc30d;}
.blue {background:#67BCCF;}
.section {width:900px;border-radius:10px; margin:50px auto;}
.section p{text-align:center;margin:0px;padding:20px;font:16px sans-serif;line-height:140%;}
.section p strong {color:gold;}
.section-list {width:900px;border-radius:10px;margin:50px auto;}
.address{margin:0px auto 50px auto;padding:0px;width:800px;text-align:center;}
.address, .address a{font:16px arial, sans-serif;color:black;}
#book-links {text-align: center;padding: 10px;color: white;}
#book-links a:link, #book-links a:visited {color: white;font:24px sans-serif;text-decoration: none;}
#book-links a:hover {text-decoration: underline;}
</style>
</head>
<body>
<div class="zzsc-container">
<header class="zzsc-header">
<div class="zzsc-demo center">
<a href="index.html">DEMO1</a>
<a href="index2.html" class="current">DEMO2</a>
</div>
</header>
<div class="section red">
<div style="padding:30px;">
<div id="photobook" style="height:150px;"></div>
</div>
<div id="book-links">
<a href="#">查看书一</a>, <a href="#">查看书二</a>, <a href="#">查看书三</a>
</div>
</div>
</div>
<script src="js/jquery-1.11.0.min.js" type="text/javascript"></script>
<script type="text/javascript" src="js/jquery.mousewheel.min.js"></script>
<script type="text/javascript" src="js/three.min.js"></script>
<script type="text/javascript" src="js/jquery.onebook3d-2.3.0-full-min.js"></script>
<script type="text/javascript">
$(function(){
var arr = [];
arr[0] = [
'ga02/001.jpg',
'ga02/002.jpg', 'ga02/003.jpg',
'ga02/004.jpg', 'ga02/005.jpg',
'ga02/006.jpg', 'ga02/007.jpg',
'ga02/008.jpg', 'ga02/009.jpg',
'ga02/010.jpg', 'ga02/011.jpg',
'ga02/012.jpg'
];
arr[1] = [
'ga03/001.jpg',
'ga03/002.jpg', 'ga03/003.jpg',
'ga03/004.jpg', 'ga03/005.jpg',
'ga03/006.jpg', 'ga03/007.jpg',
'ga03/008.jpg', 'ga03/009.jpg',
'ga03/010.jpg', 'ga03/011.jpg',
'ga03/012.jpg'
];
arr[2] = [
'ga04/001.jpg',
'ga04/002.jpg', 'ga04/003.jpg',
'ga04/004.jpg', 'ga04/005.jpg',
'ga04/006.jpg', 'ga04/007.jpg',
'ga04/008.jpg', 'ga04/009.jpg',
'ga04/010.jpg'
];
$('#photobook').onebook(arr[2]);
$('#book-links a').each(function(i){
$(this).on('click',function(){
if(arr&&arr[i]){
$('#photobook').onebook(arr[i]);
};
return false;
});
});
});
</script>
</body>
</html>
CSS代码(zzsc-demo.css):
body,html{font-size:100%;padding:0;margin:0;}
/* Reset */
*,*:after,*:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}
/* Clearfix hack by Nicolas Gallagher:http://nicolasgallagher.com/micro-clearfix-hack/ */
.clearfix:before,.clearfix:after{content:" ";display:table;}
.clearfix:after{clear:both;}
body{background:#494A5F;color:#D5D6E2;font-weight:500;font-size:1.05em;font-family:"Microsoft YaHei","宋体","Segoe UI","Lucida Grande",Helvetica,Arial,sans-serif,FreeSans,Arimo;}
a{color:rgba(255,255,255,0.6);outline:none;text-decoration:none;-webkit-transition:0.2s;transition:0.2s;}
a:hover,a:focus{color:#74777b;text-decoration:none;}
.zzsc-container{margin:0 auto;}
.bgcolor-1{background:#f0efee;}
.bgcolor-2{background:#f9f9f9;}
.bgcolor-3{background:#e8e8e8;}
/*light grey*/
.bgcolor-4{background:#2f3238;color:#fff;}
/*Dark grey*/
.bgcolor-5{background:#df6659;color:#521e18;}
/*pink1*/
.bgcolor-6{background:#2fa8ec;}
/*sky blue*/
.bgcolor-7{background:#d0d6d6;}
/*White tea*/
.bgcolor-8{background:#3d4444;color:#fff;}
/*Dark grey2*/
.bgcolor-9{background:#ef3f52;color:#fff;}
/*pink2*/
.bgcolor-10{background:#64448f;color:#fff;}
/*Violet*/
.bgcolor-11{background:#3755ad;color:#fff;}
/*dark blue*/
.bgcolor-12{background:#3498DB;color:#fff;}
/*light blue*/
.bgcolor-20{background:#494A5F;color:#D5D6E2;}
/* Header */
.zzsc-header{padding:1em 190px 1em;letter-spacing:-1px;text-align:center;background:#66677c;}
.zzsc-header h1{color:#D5D6E2;font-weight:600;font-size:2em;line-height:1;margin-bottom:0;font-family:"Microsoft YaHei","宋体","Segoe UI","Lucida Grande",Helvetica,Arial,sans-serif,FreeSans,Arimo;}
.zzsc-header h1 span{font-family:"Microsoft YaHei","宋体","Segoe UI","Lucida Grande",Helvetica,Arial,sans-serif,FreeSans,Arimo;display:block;font-size:60%;font-weight:400;padding:0.8em 0 0.5em 0;color:#c3c8cd;}
/*nav*/
.zzsc-demo a{color:#fff;text-decoration:none;}
.zzsc-demo{width:100%;padding-bottom:1.2em;}
.zzsc-demo a{display:inline-block;margin:0.5em;padding:0.6em 1em;border:3px solid #fff;font-weight:700;}
.zzsc-demo a:hover{opacity:0.6;}
.zzsc-demo a.current{background:#1d7db1;color:#fff;}
/* Top Navigation Style */
.zzsc-links{position:relative;display:inline-block;white-space:nowrap;font-size:1.5em;text-align:center;}
.zzsc-links::after{position:absolute;top:0;left:50%;margin-left:-1px;width:2px;height:100%;background:#dbdbdb;content:'';-webkit-transform:rotate3d(0,0,1,22.5deg);transform:rotate3d(0,0,1,22.5deg);}
.zzsc-icon{display:inline-block;margin:0.5em;padding:0em 0;width:1.5em;text-decoration:none;}
.zzsc-icon span{display:none;}
.zzsc-icon:before{margin:0 5px;text-transform:none;font-weight:normal;font-style:normal;font-variant:normal;font-family:'icomoon';line-height:1;speak:none;-webkit-font-smoothing:antialiased;}
/* footer */
.zzsc-footer{width:100%;padding-top:10px;}
.zzsc-small{font-size:0.8em;}
.center{text-align:center;}
/****/
.related{color:#fff;background:#494A5F;text-align:center;font-size:1.25em;padding:0.5em 0;overflow:hidden;}
.related > a{vertical-align:top;width:calc(100% - 20px);max-width:340px;display:inline-block;text-align:center;margin:20px 10px;padding:25px;font-family:"Microsoft YaHei","宋体","Segoe UI","Lucida Grande",Helvetica,Arial,sans-serif,FreeSans,Arimo;}
.related a{display:inline-block;text-align:left;margin:20px auto;padding:10px 20px;opacity:0.8;-webkit-transition:opacity 0.3s;transition:opacity 0.3s;-webkit-backface-visibility:hidden;}
.related a:hover,.related a:active{opacity:1;}
.related a img{max-width:100%;opacity:0.8;border-radius:4px;}
.related a:hover img,.related a:active img{opacity:1;}
.related h3{font-family:"Microsoft YaHei",sans-serif;font-size:1.2em}
.related a h3{font-size:0.85em;font-weight:300;margin-top:0.15em;color:#fff;}
/* icomoon */
.icon-zzsc-home-outline:before{content:"\e5000";}
.icon-zzsc-arrow-forward-outline:before{content:"\e5001";}
@media screen and (max-width:1024px){.zzsc-header{padding:2em 10% 2em;}
.zzsc-header h1{font-size:1.4em;}
.zzsc-links{font-size:1.4em}
}
@media screen and (max-width:960px){.zzsc-header{padding:2em 10% 2em;}
.zzsc-header h1{font-size:1.2em;}
.zzsc-links{font-size:1.2em}
.related h3{font-size:1em;}
.related a h3{font-size:0.8em;}
}
@media screen and (max-width:766px){.zzsc-header h1{font-size:1.3em;}
.zzsc-links{font-size:1.3em}
}
@media screen and (max-width:640px){.zzsc-header{padding:2em 10% 2em;}
.zzsc-header h1{font-size:1em;}
.zzsc-links{font-size:1em}
.related h3{font-size:0.8em;}
.related a h3{font-size:0.6em;}
}