mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-03 14:59:18 +02:00
93 lines
1.6 KiB
HTML
93 lines
1.6 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>EPUB.js Basic Example</title>
|
|
|
|
<script src="../dist/epub.js"></script>
|
|
|
|
<style type="text/css">
|
|
body {
|
|
margin: 0;
|
|
background: #fafafa;
|
|
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
color: #333;
|
|
}
|
|
|
|
#viewer {
|
|
display: block;
|
|
margin: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
#viewer iframe {
|
|
background: white;
|
|
box-shadow: 0 0 4px #ccc;
|
|
width: 590px;
|
|
margin: 10px auto;
|
|
}
|
|
|
|
|
|
#prev {
|
|
left: 40px;
|
|
}
|
|
|
|
#next {
|
|
right: 40px;
|
|
}
|
|
|
|
.arrow {
|
|
position: fixed;
|
|
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;
|
|
}
|
|
|
|
#toc {
|
|
display: block;
|
|
margin: 10px auto;
|
|
}
|
|
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="viewer"></div>
|
|
|
|
<script>
|
|
var currentSectionIndex = 10;
|
|
// Load the opf
|
|
var book = ePub("../books/accessible_epub_3-20121024.epub/package.opf");
|
|
var rendition = book.renderTo("viewer");
|
|
var displayed = rendition.display(currentSectionIndex);
|
|
|
|
|
|
displayed.then(function(renderer){
|
|
// -- do stuff
|
|
});
|
|
|
|
// Navigation loaded
|
|
book.loaded.navigation.then(function(toc){
|
|
// console.log(toc);
|
|
});
|
|
|
|
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|