var book = ePub("https://static-e879caa1-fc61-4acb-be0b-a0391be927ff.bspapp.com/1.epub");
var rendition = book.renderTo("book", {
width: window.innerWidth,
height: window.innerHeight,
manager: "continuous",
flow: "paginated",
});
rendition.display();
console.log(book);
book.loaded.navigation.then(function (toc) {
console.log(toc)
var $select = document.getElementById("toc"),
docfrag = document.createDocumentFragment();
toc.forEach(function (chapter) {
var option = document.createElement("option");
option.textContent = chapter.label;
option.ref = chapter.href;
console.log(option,option.ref);
docfrag.appendChild(option);
});
$select.appendChild(docfrag);
$select.onchange = function () {
var index = $select.selectedIndex,
url = $select.options[index].ref;
rendition.display(url);
return false;
};
});
epub.js简单实用
最新推荐文章于 2024-05-09 09:53:51 发布