File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 48
48
margin-left: auto;
49
49
margin-right:auto;
50
50
max-width: 750px;
51
+ padding-bottom: 50px;
51
52
}
52
53
53
54
.chapter {
@@ -125,4 +126,12 @@ body {
125
126
padding: 0;
126
127
}
127
128
129
+ .left {
130
+ float: left;
131
+ }
132
+
133
+ .right {
134
+ float: right;
135
+ }
136
+
128
137
"# ;
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