mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-05 15:32:55 +02:00
106 lines
2.7 KiB
HTML
106 lines
2.7 KiB
HTML
<!DOCTYPE html>
|
||
<html class="no-js">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||
<title>Basic ePubJS Example</title>
|
||
<meta name="description" content="">
|
||
<meta name="viewport" content="width=device-width">
|
||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||
|
||
<!-- zip -->
|
||
<script src="../libs/jszip/jszip.js"></script>
|
||
|
||
<!-- EPUBJS Renderer -->
|
||
<script src="../build/epub.min.js"></script>
|
||
|
||
<style type="text/css">
|
||
|
||
body {
|
||
overflow: hidden;
|
||
}
|
||
|
||
#main {
|
||
position: absolute;
|
||
width: 100%;
|
||
bottom: 0;
|
||
top: 50px;
|
||
}
|
||
|
||
#area {
|
||
width: 80%;
|
||
height: 80%;
|
||
margin: 5% auto;
|
||
max-width: 1250px;
|
||
}
|
||
|
||
#area iframe {
|
||
border: none;
|
||
}
|
||
|
||
#prev {
|
||
left: 40px;
|
||
}
|
||
|
||
#next {
|
||
right: 40px;
|
||
}
|
||
|
||
.arrow {
|
||
position: absolute;
|
||
top: 50%;
|
||
margin-top: -32px;
|
||
font-size: 64px;
|
||
color: #E2E2E2;
|
||
font-family: arial, sans-serif;
|
||
font-weight: bold;
|
||
cursor: pointer;
|
||
-webkit-user-select: none;
|
||
-moz-user-select: none;
|
||
user-select: none;
|
||
}
|
||
|
||
.arrow:hover {
|
||
color: #777;
|
||
}
|
||
|
||
.arrow:active {
|
||
color: #000;
|
||
}
|
||
|
||
#btnSelectBook {
|
||
position: absolute;
|
||
top: 20px;
|
||
left: 20px;
|
||
}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<input type="file" id="btnSelectBook"/>
|
||
<div id="main">
|
||
<div id="prev" onclick="book.prevPage();" class="arrow">‹</div>
|
||
<div id="area"></div>
|
||
<div id="next" onclick="book.nextPage();" class="arrow">›</div>
|
||
</div>
|
||
|
||
<script>
|
||
"use strict";
|
||
|
||
var book = ePub("../reader/moby-dick.epub");
|
||
book.renderTo("area");
|
||
|
||
document.getElementById('btnSelectBook').addEventListener('change', function (e) {
|
||
var file = e.target.files[0];
|
||
if (window.FileReader) {
|
||
var reader = new FileReader();
|
||
reader.onload = function (e) {
|
||
book.destroy();
|
||
book = ePub({bookPath: e.target.result});
|
||
book.renderTo("area");
|
||
}.bind(this);
|
||
reader.readAsArrayBuffer(file);
|
||
}
|
||
});
|
||
</script>
|
||
</body>
|
||
</html>
|