Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add the h1 (title) to the page specific TOC to allow quick nav to the…

… top
  • Loading branch information...
commit be1e6291f904e46d38b56d133491898739b2e19c 1 parent 1830d9f
@noelwelsh authored
Showing with 6 additions and 5 deletions.
  1. +6 −5 js/contents.js
View
11 js/contents.js
@@ -11,11 +11,12 @@ function toLink(elt) {
}
$(function() {
- var headings = toList($('h2'), function(h2) {
- return toLink(h2) + "<ul>" + toList($(h2).nextUntil('h2').filter('h3'), function(elt) {
- return toLink(elt);
- }) + "</ul>";
- });
+ var headings = toList($("h1"), function(elt) { return toLink(elt) }) +
+ toList($('h2'), function(h2) {
+ return toLink(h2) + "<ul>" + toList($(h2).nextUntil('h2').filter('h3'), function(elt) {
+ return toLink(elt);
+ }) + "</ul>";
+ });
$('#navbar').append('<ul class="nav nav-list"><li class="nav-header">On This Page</li>' + headings + '</ul>')
});
Please sign in to comment.
Something went wrong with that request. Please try again.