File tree 2 files changed +40
-0
lines changed
2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 46
46
margin-left: auto;
47
47
margin-right:auto;
48
48
max-width: 750px;
49
+ padding-bottom: 50px;
49
50
}
50
51
51
52
.chapter {
@@ -123,4 +124,12 @@ body {
123
124
padding: 0;
124
125
}
125
126
127
+ .left {
128
+ float: left;
129
+ }
130
+
131
+ .right {
132
+ float: right;
133
+ }
134
+
126
135
"# ;
Original file line number Diff line number Diff line change @@ -38,6 +38,37 @@ document.addEventListener("DOMContentLoaded", function(event) {
38
38
el.className = classes.join(' ');
39
39
}
40
40
}
41
+
42
+ // The below code is used to add prev and next navigation links to the bottom
43
+ // of each of the sections.
44
+ // It works by extracting the current page based on the url and iterates over
45
+ // the menu links until it finds the menu item for the current page. We then
46
+ // create a copy of the preceeding and following menu links and add the
47
+ // correct css class and insert them into the bottom of the page.
48
+ var toc = document.getElementById('toc').getElementsByTagName('a');
49
+ var href = document.location.pathname.split('/').pop();
50
+ if (href === 'index.html' || href === '') {
51
+ href = 'README.html';
52
+ }
53
+
54
+ for (var i = 0; i < toc.length; i++) {
55
+ if (toc[i].attributes['href'].value === href) {
56
+ var nav = document.createElement('p');
57
+ if (i > 0) {
58
+ var prevNode = toc[i-1].cloneNode(true);
59
+ prevNode.className = 'left';
60
+ nav.appendChild(prevNode);
61
+ }
62
+ if (i < toc.length - 1) {
63
+ var nextNode = toc[i+1].cloneNode(true);
64
+ nextNode.className = 'right';
65
+ nav.appendChild(nextNode);
66
+ }
67
+ document.getElementById('page').appendChild(nav);
68
+ break;
69
+ }
70
+ }
71
+
41
72
});
42
73
</script>
43
74
"# ;
You can’t perform that action at this time.
0 commit comments