This may be too late to be helpful to you, but I hope it will be helpful to others.
First, in my short experience with epub.js I have wrestled with the same question, and eventually learned that if you want to set the height
and width
options to "100%"
, as suggested in the "Getting Started" guide on the README you reference, and as you use in your example, the element you are rendering to must have a fixed height. In your case, the #area
div. Try experimenting with setting the CSS for #area
to height: 500px;
, and seeing if the epub then renders.
This is somewhat more informative epub.js documentation, but not really about set-up: http://epubjs.org/documentation/0.3/#rendition
Second, this may not be the issue for you at all, I know the README instructs referencing <script src="../dist/epub.min.js"></script>
exactly as you have it, but for my purposes in a Rails 5.1 application with Webpack, that did not work.
Instead I added it to the project with Yarn (yarn add epubjs
, or npm install epubjs
if you use npm), and then imported it into the relevant file (in my case a Vue component) with import ePub from 'epubjs'
.
You can check if you have epub.js loaded by console logging your book
or rendition
variables after you define them (console.log(book)
or console.log(rendition)
, in your example). If they are objects chock-full of fancy functions unfamiliar to you, you'll know you've got epub.js on the page, and the issue is more likely the height/width values.