简体   繁体   English

iBooks JavaScript资源

[英]iBooks JavaScript resources

iBooks recently started supporting JavaScript inside epub. iBooks 最近 开始在epub中支持 JavaScript。 Where is this documented? 这记录在哪里?

Are there any code examples to get started? 是否有任何代码示例可供使用?

** Update, one year later : This has been now documented for several months in the official Apple Docs available on iTunes Connect **一年后更新:现在已经在iTunes Connect上提供的官方Apple Docs中记录了几个月


From what i've seen, you already have quoted the best known sources. 从我所看到的,你已经引用了最知名的消息来源。

I think that it is not documented anywhere in the official docs from Apple. 我认为Apple的官方文档中没有任何文档记录。 Here are some elements from what I've experienced. 以下是我所经历的一些元素。

Features supported by iBooks iBooks支持的功能

A lot of things that work on Safari work on iBooks too. 很多适用于Safari的东西也可以在iBooks上运行。 You already have access to HTML5 features like internal DB, canvas, etc. The biggest problems I saw were related to slowness and vertical positionning. 您已经可以访问内部数据库,画布等HTML5功能。我看到的最大问题与缓慢和垂直定位有关。 There are problems with pagination too : if you add content, pages are not added to the end and the content can overflow. 分页也存在问题:如果添加内容,页面不会添加到结尾,内容可能会溢出。

Validation for the iBookStore 验证iBookStore

Before being published on the iBookStore, it relates entirely on Apple's arbitrary validation when it comes to Javascript. 在发布到iBookStore之前,它完全取决于Apple在Javascript方面的任意验证。 I know at least one ePub with interactive forms and DB , that they have validated. 我知道至少有一个带有交互式表格和数据库的ePub已经过验证。

For lack of better resources, I created a open-source example of using JQuery to show an alert. 由于缺乏更好的资源,我创建了一个使用JQuery来显示警报的开源示例 Might be helpful as a starting point. 可能有帮助作为一个起点。

The examples you give refer to the interactivity in the body of the books. 您提供的示例涉及书籍正文中的交互性。 Javascript scripting can also be used within the HTML widgets: Javascript脚本也可以在HTML小部件中使用:

HTML widget boiler plate on github -- https://github.com/TrevorBurnham/iBooks-HTML-Widget-Boilerplate . github上的HTML小部件样板 - https://github.com/TrevorBurnham/iBooks-HTML-Widget-Boilerplate

iBook Widgets with D3.js -- http://vallandingham.me/ibooks_and_d3.html (to check the widget, click on 'download a copy of my iBook file', change the iba extension to 'zip', uncompress, navigate to vis-1.wdgt) 使用D3.js的iBook小部件 - http://vallandingham.me/ibooks_and_d3.html (要查看小部件,请单击'下载我的iBook文件的副本',将iba扩展名更改为'zip',解压缩,导航到VIS-1.wdgt)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM