View Single Post
Old 02-02-2017, 07:34 AM   #10
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,355
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Quote:
Originally Posted by chaot View Post
Chapter Title A would look like:
Code:
<body>
  <h2 id="auto1Gen1Code1">Title A</h2> 

  <p>Introducing text</p>

  <h2 id="auto2Gen2Code2">Aa</h2>

  <p>Some text</p>

  <h3 id="auto3Gen3Code3">SubtitleAa</h3>

  <p>More text</p>

  <h2 id="auto4Gen4Code4">End</h2>  

  <p>Closing phrase</p>

<body>
Question: In ereader: How I jump back from header Aa or SubtitleAa to
a) Content or
b) to the respective entry there?
(We don't speak about the auto-generated ToC.)

Instead of telling you what your styling should look like, the answer to your question is to use an <a> with an href back to your ToC page:

a) To take you back to the top of your Contents page
<h2 id="auto1Gen1Code1"><a href="../Text/contents.xhtml">Title A</a>

b) To take you back to the respective entry ON the Contents page would require each of the entries on the contents page to have a specific id
<h2 id="auto2Gen2Code2"><a href="../Text/contents.xhtml#IDforAa">Aa</a></h2>

and

<h3 id="auto3Gen3Code3"><a href="../Text/contents.xhtml#IDforSubtitleAa">SubtitleAa</a></h3>

where your TOC page has something like this:
Code:
<ul>
<li id="IDforTitleA"><a href="../Text/somepage.xhtml">TitleA</li>
<li id="IDforAa"><a href="../Text/somepage.xhtml#auto2Gen2Code2">Aa</li>
<li id="IDforSubtitleAa"><a href="../Text/somepage.xhtml#auto3Gen3Code3">SubtitleAa</li>
</ul>
Adding the "#" with a specific ID at the end of your href takes you to that specific point on a page. If you do not have the "#" then it just takes you to the top of that page. eg. if your chapter header is the top of the page you do not need the "#".

You can have the id for each item on your contents page either in the <li> as shown in the example above, or in the <a> tag itself (eg <li><a href="../Text/somepage.xhtml" id="IDforTitleA">TitleA</li>)...the result is effectively the same unless you have some really crazy styling as I mentioned in my post above.

Cheers!
Turtle91 is offline   Reply With Quote