sphinx_rtd_theme
Sticky navigation option
#82
Merged

Sticky navigation option #82

snide merged 5 commits into readthedocs:master from sticky-navigation
ehough
ehough11 years ago

This PR introduces a theme option to enable "sticky" navigation. Demo: http://youtu.be/6tBrRIbxgHQ.

Features:

  • Disabled by default, so all existing installs are unmodified
  • User can turn on/off from conf.py via sticky_navigation boolean option
  • If nav bar is taller than window, stick nav is turned off. This prevents "unreachable" spots in the nav bar. See YT video for a demo.
ehough Adding sticky navigation option
bcf2276d
ehough Turning off sticky navigation if navbar is taller than window
30f5c683
ehough Merge remote-tracking branch 'snide/master' into sticky-navigation
9b26927f
ehough Merge branch 'snide-master' into sticky-navigation
0cd262d0
ehough Commenting out sticky_navigation option by default
db06dad6
ericholscher
ericholscher reviewed on 2014-01-08
sphinx_rtd_theme/static/js/theme.js
1515 $("table.docutils:not(.field-list").wrap("<div class='wy-table-responsive'></div>");
1616});
17
18
window.SphinxRtdTheme = (function (jquery) {
ericholscher11 years ago

Any reason these all have extra spacing between all the statements?

ehough11 years ago

No reason - just my (ahem, unique?) JS code style. Feel free to remove it. I'm used to having all my JS compressed, too, so I sometimes I just forget about the extra spacing.

ericholscher
ericholscher11 years ago

Thanks for the PR. I know @snide was resistent to making it default, but having it be an option seems like a win for people that want it.

Another option with the menu overflow problem is to make it individually scrollable. Though IIRC that is what we were trying to avoid when we didn't add support, so I think this is a good solution.

snide
snide11 years ago

I'll check this out tonight. Looking at the YT vid though that's how I wanted to set it up, because I really hate scroll bars in nav, and dropping it if the nav is too tall is a good solution.

Thanks for this and your earlier subs. Appreciate the help and hope the code was clean / documented enough for you.

snide snide merged db06dad6 into master 11 years ago
snide
snide11 years ago

Nice PR. Thanks for making sure this still worked in mobile. Made some minor documentation changes.

Also, I found this to be enabled by default during testing, which is fine as long as it gracefully exists on long ones (which it did).

ehough ehough deleted the sticky-navigation branch 11 years ago
ehough
ehough11 years ago

Also, I found this to be enabled by default during testing, which is fine as long as it gracefully exists on long ones (which it did).

Very strange. Seems like if we change the line in layout.html from

{% if theme_sticky_navigation %}

to

{% if theme_sticky_navigation == true %}

then Jinja correctly performs the boolean comparison. I don't know enough about Python to really figure out what's going on there, but might be something to keep in mind for the future. And as you said having sticky navigation enabled by default isn't really a problem.

Login to write a write a comment.

Login via GitHub

Reviewers
No reviews
Assignees
No one assigned
Labels
Milestone