3

当用户在页面之间切换时,我有一个没有任何效果或动画的 .epub 文件

我使用Turn.js库,因为它不起作用。我无法用电子书阅读器软件打开它。

这是我的 Epub 文件夹目录

添加 Turn.js 库之前

之前

添加 Turn.js 库
后

这是我的chap_0001.xhtml Html 代码

  <head>
    <title>How to Win Every Argument</title>
    <link href="style/style.css" rel="stylesheet" type="text/css"/>
	<meta name="viewport" content="width = 1050, user-scalable = no" /><!-- Added-->
	<script type="text/javascript" src="extras/jquery.min.1.7.js"></script><!-- Added -->
	<script type="text/javascript" src="extras/modernizr.2.5.3.min.js"></script><!-- Added-->
  </head>
  <body dir="auto">
  <h1 dir="ltr" class="center">How to Win Every Argument</h1><p dir="ltr" class="center bold">Madsen Piri</p>
  
 <div class="offset">
  <div class="flipbook-viewport"><!-- Added-->
	<div class="container"><!-- Added-->
		<div class="flipbook"><!-- Added-->

		<div style="width: 100.0%;">
		<img src="images/img_0001.png" alt="Picture #1"/>
		</div>
		<span xmlns:epub="http://www.idpf.org/2007/ops" id="1" title="1" epub:type="pagebreak"/>
		<div style="width: 37.238758708043065%;">
		<img src="images/img_0002.png" alt="Picture #2"/>
		</div>
		<span xmlns:epub="http://www.idpf.org/2007/ops" id="2" title="2" epub:type="pagebreak"/>
		<div style="width: 45.59848005066498%;">
		<img src="images/img_0003.png" alt="Picture #3"/>
		</div>
		
		<!-- rest of pages -->
	      </div>	
	  </div>	
   </div>	
  </div>	

这是我的chap_0001.xhtml Js 代码

<!-- language: lang-js -->
//Added after using Turn.js library
    function loadApp() {
      // Create the flipbook
      $('.flipbook').turn({
        // Width
        width: 922,
        // Height
        height: 600,
        // Elevation
        elevation: 50,
        // Enable gradients
        gradients: true,
        // Auto center this flipbook
        autoCenter: true

      });
    }

    // Load the HTML4 version if there's not CSS transform

    yepnope({
      test: Modernizr.csstransforms,
      yep: ['lib/turn.js'],
      nope: ['lib/turn.html4.min.js'],
      both: ['style/basic.css'],
      complete: loadApp
    });

我只复制库文件夹并更改 chap_0001.xhtml 文件。而已。

任何帮助将不胜感激

4

1 回答 1

1

我不确定你的脚本有什么特别的问题。一个主要问题是您在 html 中包含的额外跨度:

<span xmlns:epub="http://www.idpf.org/2007/ops" id="1" title="1" epub:type="pagebreak"/>
<span xmlns:epub="http://www.idpf.org/2007/ops" id="2" title="2" epub:type="pagebreak"/>

它们被认为是“页面”,因此 turn.js 将页面变为与其他元素大小不同的空白跨度。

无论如何,这是一个使用您的 html 的工作示例:JSFiddle Example

我无法在此处包含工作代码,因为 turn.js 是通过 http 提供的。我不得不复制整个代码并粘贴到超过stackoverflow文本限制的js部分

于 2019-10-29T00:19:39.327 回答