Files @ 476a42bf0d73
Branch filter:

Location: Copyleft/guide/tex4ht.usr

bkuhn
In-page anchor links vs. bootstrap's fixed navbar

@keynote2k was the first to point out that the in-page anchor links in
the Guide failed to function properly, due to Bootstrap's fixed navbar.

This mixed solution of CSS and Javascript is the best solution I've been
able to come up with for the problem. The CSS solution is obviously
preferable, and is used herein for those anchor id attributes in the
Guide that have no href of their own.

Due to problems with using a pure CSS solution where the anchor includes
both an href and a id attribute. The Javascript solution is specific
for those cases. I took care not to have them both happen at once, as
they would undoubtedly conflict.

I did a inordinate amount of research about this issue. Bootstrap's own
page about the fixed navbar:
http://getbootstrap.com/examples/navbar-fixed-top/

doesn't discuss this issue at all, but there is a bug in Booststrap's
bugtracker:
https://github.com/twitter/bootstrap/issues/1768

which discusses the issue. (However, I don't understand why that bug is
closed, since none of the solutions I implement herein truly solve it).

The most useful page I found regarding this issue is this one:
http://nicolasgallagher.com/jump-links-and-viewport-positioning/demo

which offers several pure CCS solutions (each with drawbacks and
advantages). Unfortunately, none of those solutions consider the
question of anchor links that have both href and id attributes, and none
of them work properly in that situation.
\newcommand{\footermenu}{\HCode{
     <footer class="navbar navbar-default navbar-fixed-bottom copyleft-navbar">\Hnewline
       <div class="container">\Hnewline
     <nav class="collapse navbar-collapse copyleft-navbar-collapse" role="navigation">\Hnewline
     <p class="navbar-text navbar-left">License:
        <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">CC By SA 4.0 International</a></p>\Hnewline}}

\:CheckOption{monolith} \if:Option
   \newcommand{\monolith}{\Configure{@BODY}{\footermenu\HCode{</nav></div></footer>}}}
   \newcommand{\selectpropermenuitem}{\HCode{<li><a href="/guide/">HTML</a></li>\Hnewline
          <li class="active"> <a href="/guide/monolithic">HTML (1 pg)</a></li>\Hnewline}}
 \else
   \newcommand{\selectpropermenuitem}{\HCode{<li class="active"><a href="/guide">HTML</a></li>\Hnewline
               <li><a href="/guide/monolithic">HTML (1 pg)</a></li>\Hnewline}}
   \newcommand{\monolith}{\Configure{next+}{\footermenu\HCode{\Hnewline<nav class="collapse navbar-collapse copyleft-navbar-collapse" role="navigation"><ul class="nav navbar-nav navbar-right">}}{\HCode{</ul></nav></div></footer>}}}
 \fi