iBooks JavaScript 资源
iBooks 最近 开始 支持 epub 内的 JavaScript。这是在哪里记录的?
有任何代码示例可以开始吗?
iBooks recently started supporting JavaScript inside epub. Where is this documented?
Are there any code examples to get started?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
** 一年后更新:这已在 iTunes Connect 上提供的官方 Apple 文档中记录了几个月
。据我所知,您已经引用了最知名的来源。
我认为苹果官方文档中没有任何记录。以下是我所经历的一些要素。
iBooks 支持的功能
许多适用于 Safari 的功能也适用于 iBooks。您已经可以访问 HTML5 功能,例如内部数据库、画布等。我看到的最大问题与速度缓慢和垂直定位有关。分页也存在问题:如果添加内容,页面不会添加到末尾,内容可能会溢出。
iBookStore 验证
在 iBookStore 上发布之前,它完全与 Apple 对 Javascript 的任意验证相关。我知道至少一个带有交互式表单的 ePub和 DB,他们已经验证了。
** Update, one year later : This has been now documented for several months in the official Apple Docs available on iTunes Connect
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. Here are some elements from what I've experienced.
Features supported by iBooks
A lot of things that work on Safari work on iBooks too. You already have access to HTML5 features like internal DB, canvas, etc. The biggest problems I saw were related to slowness and vertical positionning. 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
Before being published on the iBookStore, it relates entirely on Apple's arbitrary validation when it comes to Javascript. I know at least one ePub with interactive forms and DB, that they have validated.
由于缺乏更好的资源,我创建了一个开源 示例,使用 JQuery 来展示警报。作为起点可能会有所帮助。
For lack of better resources, I created a open-source example of using JQuery to show an alert. Might be helpful as a starting point.
您给出的示例涉及书籍正文中的交互性。 Javascript 脚本也可以在 HTML 小部件中使用:
github 上的 HTML 小部件样板 - https: //github.com/TrevorBurnham/iBooks-HTML-Widget-Boilerplate。
使用 D3.js 的 iBook 小部件 --
http://vallandingham.me/ibooks_and_d3.html
(要检查小部件,请单击“下载我的 iBook 文件的副本”,将 iba 扩展名更改为“zip”,解压缩,导航到 vis-1.wdgt)
The examples you give refer to the interactivity in the body of the books. Javascript scripting can also be used within the HTML widgets:
HTML widget boiler plate on github -- 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)