Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 09-18-2023, 01:03 PM   #1
amarie0
Enthusiast
amarie0 doesn't litteramarie0 doesn't litter
 
Posts: 27
Karma: 110
Join Date: Dec 2010
Location: Chicago, IL
Device: iPad, Kindle
Javascript in Fixed Layout epubs

Is anyone using Javascript to add interactivity to their ebooks? Even something as simple as button actions?

I'm looking for resources -- books or forums -- where knowledgeable interactive epub devs hang out. Or at least, where posting a JS question specific to an epub project has a chance of being answered ;-)

Thanks!
AM
amarie0 is offline   Reply With Quote
Old 09-18-2023, 03:13 PM   #2
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 11,467
Karma: 87454321
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
Pointless.
Also PDF is far better for fixed layout. Anyone with a big enough screen can read it.

Do an iOS/Android app if you want interactive, and don't make it fixed layout.
Quoth is offline   Reply With Quote
Advert
Old 09-18-2023, 04:27 PM   #3
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,488
Karma: 129668758
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by amarie0 View Post
Is anyone using Javascript to add interactivity to their ebooks? Even something as simple as button actions?

I'm looking for resources -- books or forums -- where knowledgeable interactive epub devs hang out. Or at least, where posting a JS question specific to an epub project has a chance of being answered ;-)

Thanks!
AM
JS in an ePub doesn't work in more places then it works. It's not worth it to even bother to try.
JSWolf is offline   Reply With Quote
Old 09-18-2023, 09:26 PM   #4
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,713
Karma: 5444398
Join Date: Nov 2009
Device: many
I completely disagree with both earlier responses to your question.
Some people do use JS for interactivity in epubs. I believe I have a travel book epub3 someplace that uses JS to do some interesting things. If I can find it I will post it for you so you can see some examples.
KevinH is offline   Reply With Quote
Old 09-18-2023, 10:12 PM   #5
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,586
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
The knee-jerk adverse reaction to anything/anyone mentioning "interactivity" in epubs is tiresome. Text-based novels are not going to go extinct just because some interactive epubs get sold. There's room for both. Relax.
DiapDealer is offline   Reply With Quote
Advert
Old 09-18-2023, 10:52 PM   #6
azimuth
Enthusiast
azimuth plays well with othersazimuth plays well with othersazimuth plays well with othersazimuth plays well with othersazimuth plays well with othersazimuth plays well with othersazimuth plays well with othersazimuth plays well with othersazimuth plays well with othersazimuth plays well with othersazimuth plays well with others
 
Posts: 33
Karma: 2538
Join Date: Aug 2023
Location: NW US
Device: none
JS in Epub3 is useful for the designer -- so long as you're ebook is aimed to specific marketplaces (iOS Apple, Kobo marketplace, etc - but not KDP), using EPUB3 code.

Your chosen end user group is also key (is it a person sitting in a room reading an eBook late at night, or a person out walking along a hiking trail needing to look at their cell phone at the eBook for further information, or a photo gallery ebook).

If its just a person reading general fiction at home, or old books converted to epub, then that group of persons may not need anything more than Epub2 code, and a generic eReader device.

That being said, posting here at MobileRead (posting with the post heading specifically mentioning JS code).
Other sites out there:
ebooks.stackexchange, or at
stackoverflow (at epub3 tags).
Posting here on MobileRead has many Epub2 coders, and a core that code for Epub3 (using it in its basic form w/o touching its more extensive potential).

But for those epub designers who create new designed ebooks loaded with imagery, loaded with technical information intended for a user such as a sports based ebook -- then JS code certainly can be useful to the epub designer.

Start a new post page somewhere in ethernet world and we'd be interested to read your posts about epub JS code.
azimuth is offline   Reply With Quote
Old 09-19-2023, 12:29 AM   #7
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,566
Karma: 7043711
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
JS in epub, in some cases, is essential. For example, to format poetry. Also, I use JS to add fleurons at the end of a chapter according to the "free space" between the last line of text in the chapter and the the end of the ereader screen. If the space is big, then a fleuron is added. JS detect is the size of the font has changed and, according to that, it can add fleurons where there was not any, and remove some others (because blank spaces have changed with the change of the font size). More over, it's possible to give with JS practically a full format to text coded only with html tags (all styles are applied by the script) althought I must say that I prefer to style "by hand". And also you can add hyphens with JS (hyphenator is pure javascript).
RbnJrg is offline   Reply With Quote
Old 09-19-2023, 05:18 AM   #8
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 11,467
Karma: 87454321
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
Quote:
Originally Posted by RbnJrg View Post
JS in epub, in some cases, is essential. For example, to format poetry. Also, I use JS to add fleurons at the end of a chapter according to the "free space" between the last line of text in the chapter and the the end of the ereader screen.
Neither of those are needed at all. Especially not poetry. Also won't work on many things.

Giving yourself extra work for a negative benefit.
Quoth is offline   Reply With Quote
Old 09-19-2023, 05:26 AM   #9
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 11,467
Karma: 87454321
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
Quote:
Originally Posted by DiapDealer View Post
The knee-jerk adverse reaction to anything/anyone mentioning "interactivity" in epubs is tiresome. Text-based novels are not going to go extinct just because some interactive epubs get sold. There's room for both. Relax.
Yes, there is, but interactive and epub is an oxymoron. Having produced multimedia for years, epub is a stupid choice for interactivity. It was even stupid adding it to PDF; that should have been a different format, especially as Adobe also had Action Script and Flash (which isn't just about video or games). But now those are obsoleted and replaced by iOS/Android frameworks for phone and tablet.
All the arguments against Action Script and Flash even more so apply to epub with Javascript. It and other multimedia should never have been in epub3. Better tools for the job.
Quoth is offline   Reply With Quote
Old 09-19-2023, 05:29 AM   #10
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 11,467
Karma: 87454321
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
Quote:
Originally Posted by KevinH View Post
I completely disagree with both earlier responses to your question.
Some people do use JS for interactivity in epubs. I believe I have a travel book epub3 someplace that uses JS to do some interesting things. If I can find it I will post it for you so you can see some examples.
And it would be easier for users to deploy and work better as an iOS /Android App (or Amazon Fire store, which is basically Android).

Of course it's possible, that doesn't mean it's the best solution.
Quoth is offline   Reply With Quote
Old 09-19-2023, 06:11 AM   #11
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,586
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Yada, yada. Blah, blah, blah. Your arguments against remain unconvincing, and smack of "you kids get off my lawn." You shouldn't care so much. Someone else's potential failure to do things "right" will not bring the whole works crashing down. We don't need a "keep your interactivity outta our epub" police force.
DiapDealer is offline   Reply With Quote
Old 09-19-2023, 09:17 AM   #12
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 11,467
Karma: 87454321
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
I don't care much. If I cared much I'd encourage it as it reduces competition. People are free to do it, but if they want a bigger market and more flexibility there are better routes to interactive than epub3.
Quoth is offline   Reply With Quote
Old 09-19-2023, 09:59 AM   #13
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,586
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by Quoth View Post
I don't care much.
And yet any time Epub and Interactivity are mentioned in the same sentence: there you are discouraging it.
DiapDealer is offline   Reply With Quote
Old 09-19-2023, 11:52 AM   #14
amarie0
Enthusiast
amarie0 doesn't litteramarie0 doesn't litter
 
Posts: 27
Karma: 110
Join Date: Dec 2010
Location: Chicago, IL
Device: iPad, Kindle
Quote:
Originally Posted by KevinH View Post
I believe I have a travel book epub3 someplace that uses JS to do some interesting things. If I can find it I will post it for you so you can see some examples.
thank you KevinH. Would love to see it!
amarie0 is offline   Reply With Quote
Old 09-19-2023, 12:01 PM   #15
amarie0
Enthusiast
amarie0 doesn't litteramarie0 doesn't litter
 
Posts: 27
Karma: 110
Join Date: Dec 2010
Location: Chicago, IL
Device: iPad, Kindle
Some great responses here, thank you, along with some head-scratchers (e.g. use PDF instead)...

One reason I posted here is because I'm asked about Javascript in ebooks a lot, as I teach InDesign > EPUB and have a few video courses on it. I don't cover coding really, other than demo-ing Sigil and Calibre and BBEdit should the intrepid ebook designer want to try their hand at it.

The latest question from a user had to do with preventing the ereader from interpreting a tap on a button in an FXL as a tap to move to the next page. He reported back that he found the solution in the Kobo documentation on github, in the Javascript section, which apparently also works for Books app.

https://github.com/kobolabs/epub-spe...script-support

Sharing that here because I found it it interesting that Kobo covers it at all.
amarie0 is offline   Reply With Quote
Reply

Tags
fixed layout epub 3, javascript


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to export PDFs as Fixed-Layout ePubs in Calibre? garethd Conversion 10 09-10-2023 02:33 PM
'Polish Book' on fixed-layout ePubs ownedbycats Calibre 3 03-25-2022 10:20 PM
Fixed Layout odedta ePub 2 03-03-2016 02:05 PM
Text within Graphics in Fixed Layout ePubs verydeepwater ePub 4 01-23-2013 02:34 PM
Fixed layout epubs misstamlin ePub 3 05-19-2011 02:28 AM


All times are GMT -4. The time now is 01:48 AM.


MobileRead.com is a privately owned, operated and funded community.