Permalink
Browse files

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

… top
  • Loading branch information...
1 parent 1830d9f commit be1e6291f904e46d38b56d133491898739b2e19c @noelwelsh committed Apr 19, 2012
Showing with 6 additions and 5 deletions.
  1. +6 −5 js/contents.js
View
@@ -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>')
});

0 comments on commit be1e629

Please sign in to comment.