mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-04 15:09:16 +02:00
Added error handles, sections, updated url resolving, use book.request for requests
This commit is contained in:
parent
c6465177c5
commit
c29e5f84ee
19 changed files with 3049 additions and 683 deletions
93
examples/basic.html
Normal file
93
examples/basic.html
Normal file
|
@ -0,0 +1,93 @@
|
|||
<!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>
|
Loading…
Add table
Add a link
Reference in a new issue