MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   ePub (https://www.mobileread.com/forums/forumdisplay.php?f=179)
-   -   Is it possible to have a back button (https://www.mobileread.com/forums/showthread.php?t=330779)

increase 06-16-2020 08:40 AM

Is it possible to have a back button
 
When reading the ebook and linking to an appendix, is it possible to have a back link to return to the pervious page?

something like history.back()

JSWolf 06-16-2020 09:01 AM

The back link has to be part of the eBook's code.

increase 06-16-2020 09:03 AM

Quote:

Originally Posted by JSWolf (Post 4000846)
The back link has to be part of the eBook's code.

Thank you, do you have n example of the code for kindle?

JSWolf 06-16-2020 09:14 AM

Quote:

Originally Posted by increase (Post 4000848)
Thank you, do you have n example of the code for kindle?

Here is code that will work.
Code:

<p class="paraNoIndent">There are many kinds of vampires. Indeed, it is said that there are as many kinds of vampires as there are types of disease.<span class="footnoteRef"><a href="9780061807862_Footnote.xhtml#footnote1" id="footnote_1">[*]</a></span> And they’re not just human (if vampires are human). All along the Ramtops may be found the belief that any apparently innocent tool, be it hammer or saw, will seek blood if left unused for more than three years. In Ghat they believe in vampire watermelons, although folklore is silent about <i>what</i> they believe about vampire watermelons. Possibly they suck back.</p>
Here is the back code.
Code:

<p class="footnote" id="footnote1"><span class="footnotePara"><a href="9780061807862_Chapter_1.xhtml#footnote_1">[*]</a> Which presumably mean that some are virulent and deadly, and others just make you walk in a funny way and avoid fruit.</span></p>
Here is the CSS code.
Code:

body {
  widows: 1;
  orphans: 1;
  margin-top: 0;
  margin-right: 0;
  margin-bottom: 0;
  margin-left: 0;
  text-align: justify;
}
img {
  max-width: 100%;
  max-height: 100%;
}
p {
  margin-top: 0;
  margin-bottom: 0;
  text-indent: 1.2em;
}
.aboutAuthorPage {
  page-break-before: always;
}
.aboutAuthorText {
  text-align: justify;
  text-indent: 0;
  margin-top: 0;
  margin-bottom: 0.8em;
}
.chapterNumber {
  margin-top: 0.8em;
  margin-bottom: 0.8em;
  text-align: center;
  text-indent: 0;
  font-size: large;
  font-weight: bold;
}
.chapterOpenerText {
  margin-bottom: 0;
  margin-top: 0;
  margin-left: 0;
  text-indent: 0;
}
.contentsHead {
  margin-top: 0.8em;
  margin-bottom: 0.8em;
  text-align: center;
  text-indent: 0;
  font-size: large;
  font-weight: bold;
}
.copyrightPage {
  page-break-before: always;
}
.copyrightText {
  font-size: small;
  margin-top: 0.8em;
  font-weight: normal;
  margin-bottom: 0;
  text-indent: 0;
  text-align: justify;
}
.footnote {
  margin-bottom: 1.5em;
  font-style: normal;
  font-weight: bold;
  text-indent: 1.5em;
  text-align: justify;
}
.footnotePara {
  margin-bottom: 2em;
  font-style: normal;
  font-weight: normal;
  text-indent: 0;
  text-align: justify;
}
.footnoteRef {
  display: inline;
  font-style: normal;
  font-weight: bold;
  vertical-align: top;
}
.paraCenter {
  margin-bottom: 2%;
  text-indent: 0;
  text-align: center;
}
.paraNoIndent {
  padding-top: 2em;
  text-indent: 0;
  text-align: justify;
}
.paraNoIndent1 {
  padding-top: 1em;
  text-indent: 0;
  text-align: justify;
}

I've posted the entire CSS.

It's the use of the ID that says where the links land in the XHTML file.

increase 06-16-2020 09:27 AM

Not quite what I was meaning, in html history.back() returns back to the previous page in history, so if I use an xhtml link it would return to that page, not the previous page.

Seems the Walk Search History plugin is what i had in mind, but it is not available for Sigil

Doitsu 06-16-2020 09:36 AM

Quote:

Originally Posted by increase (Post 4000839)
When reading the ebook and linking to an appendix, is it possible to have a back link to return to the pervious page?

something like history.back()

Theoretically, it's possible, but only in epub3 books. You can find a proof-of-concept epub3 book here.

hobnail 06-16-2020 01:24 PM

Quote:

Originally Posted by increase (Post 4000853)
Not quite what I was meaning, in html history.back() returns back to the previous page in history, so if I use an xhtml link it would return to that page, not the previous page.

Seems the Walk Search History plugin is what i had in mind, but it is not available for Sigil

history.back() is not html, it's javascript. For jumping to footnotes in html you use "a" or anchor tags, for example
Code:

<a href="#note1" id="backref1">[Note 1]</a>
The href specifies where to jump. The id gives a destination for another anchor tag to jump to; in this case it's how the return knows where to go. Here's the html at the bottom of the file for the footnote:
Code:

<a id="note1"></a>Hannibal, Missouri. (<a href="#backref1">Return to previous place.</a>
The pound/sharp sign in front of the note1 and backref1 mean that it's a specific location in the html file (the id of another anchor tag), as compared to the usual linking to an html file like you would with a web page link.

JSWolf 06-16-2020 01:45 PM

Quote:

Originally Posted by Doitsu (Post 4000858)
Theoretically, it's possible, but only in epub3 books. You can find a proof-of-concept epub3 book here.

Would it work in a KF8 eBook? I know it won't work in Mobi or KFX.

jhowell 06-16-2020 02:09 PM

Quote:

Originally Posted by JSWolf (Post 4000953)
Would it work in a KF8 eBook? I know it won't work in Mobi or KFX.

No. JavaScript is not supported in KF8.

Of course on a Kindle you can just use the back button to return to your prior location.

JSWolf 06-16-2020 05:50 PM

Quote:

Originally Posted by jhowell (Post 4000960)
No. JavaScript is not supported in KF8.

Of course on a Kindle you can just use the back button to return to your prior location.

You can go back to your prior location on a Kobo as well.


All times are GMT -4. The time now is 10:00 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.