我需要书库的功能,为此我使用过:
Turn.js,用于flipbook效果(只有第3个版本正常工作,第4个版本不能使用它,如果有人与turn.js的第4个版本有类似的功能,那么请分享你的代码).
pdf.js,在客户端将PDF转换为HTML
这是我所遵循的参考链接.
我已经修改了一个动态使用该脚本的功能,它将PDF的路径添加到该功能中,并根据该链接,在弹出窗口中打开书籍.
这是JavaScript函数:
function display_book(path){
var url = path;
PDFJS.disableWorker = false;
PDFJS.getDocument(url).then(function(pdfDoc) {
numberOfPages = pdfDoc.numPages;
pdf = pdfDoc;
$('#book').turn.pages = numberOfPages;
$('#book').turn({acceleration: false,
pages: numberOfPages,
elevation: 50,
gradients: !$.isTouch,
// display: 'single',
when: {
turning: function(e, page, view) {
// Gets the range of pages that the book needs right now
var range = $(this).turn('range', page);
// Check if each page is within the book
for (page = range[0]; page<=range[1]; …Run Code Online (Sandbox Code Playgroud)