一千萬個為什麽

搜索

如何在epub文件中的所有電子閱讀器中可靠地切換文本?



我試圖制作一個多語言電子書,我有兩個不同的同一個故事的翻譯。我試圖獲得它,以便您可以通過單擊各個段落來切換語言。我在前一段時間詢問了Stackoverflow的類似問題,但我發現並非所有的電子書閱讀器都支持Javascript。

我想我會試著用CSS來做。我只是復選框破解,我在這是 Stackoverflow線程,但沒有奏效。如何重新創建電子閱讀器的切換效果。

盡管這可能很困難,但我已經在之前完成了

轉載註明原文: 如何在epub文件中的所有電子閱讀器中可靠地切換文本?

一共有 1 個回答:

Javascript would be the best way to do this, but as you note, not all ebook reading systems support Javascript—in fact, very few of them beyond iBooks do. Without Javascript, this isn't really possible, unfortunately. The doppletext site that you link to uses Javascript, for example.

Ebook reading systems support a fairly limited subset of HTML and CSS. Of particular relevance, most of them do not support the advanced CSS selectors like the type being used in the checkbox hack that you link—there's no selecting the adjacent sibling.

我能想到的唯一的另一個選擇是epub 3.0的 <�代碼> epub的:觸發器</代碼> 。不幸的是,目前只允許您切換 visibility:hidden ,而不是 display:none ,這意味著不可見段落占用的空間仍然存在,你的文本中會有巨大的翻譯大小的漏洞。即使IDPF向 epub:trigger 添加了 display 控件,epub 3在閱讀系統中的支持也令人遺憾地缺乏(盡管這是現在兩年半的核準標準),所以這可能不會讓你比使用JavaScript更遠。

Sorry for being the bearer of bad news! I'd love to be proven wrong on this—I've worked on several ebook projects that could benefit from this type of thing, and have never been able to find a way to do this acceptably other than with Javascript.