Skip to content

Commit 14271c9

Browse files
committed
fix ToC toggle buttom
1 parent f8d1d0b commit 14271c9

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

html/css/style.css

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,12 @@ footer.pretty-box {
283283
footer.pretty-box p {
284284
margin: 3px 0; }
285285

286-
#TOC_title {
287-
font-size: 120%; }
288-
#TOC_title a {
286+
#TOC_Title {
287+
font-size: 120%;
288+
white-space: nowrap;
289+
}
290+
291+
#TOC_Title a {
289292
font-weight: normal;
290293
font-size: 90%;
291294
outline: 0;
@@ -327,7 +330,6 @@ table#TOC tr.toc-level-1 td.toc-text {
327330
left: 0pt;
328331
}
329332

330-
331333
table#TOC code {
332334
color: blue;
333335
}

html/js/main.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function setup_auto_title_anchors() {
3030

3131
function setup_collapsible_TOC() {
3232
var state;
33-
if ( ! $('nav.indexgroup > ol').length ) { return; }
33+
if ( ! $('nav.indexgroup') ) { return; }
3434

3535
// fix for jumpy .slideDown() effect
3636
$('nav.indexgroup > ol').each( function(){
@@ -42,23 +42,23 @@ function setup_collapsible_TOC() {
4242
$('nav.indexgroup > ol').hide();
4343
}
4444

45-
$('nav.indexgroup')
46-
.prepend('<h2 id="TOC_title">Table of Contents'
47-
+ ' <a href="#">['
45+
$('nav.indexgroup').find('#TOC_Title')
46+
.append(
47+
'<a id="TOC_toggle_button" href="#">['
4848
+ ( state == 'hidden' ? 'show' : 'hide')
4949
+ ']</a></h2>'
5050
)
51-
.find('> h2 > a')
51+
.find('#TOC_toggle_button')
5252
.click(function() {
5353
var el = $(this);
5454
if (el.text() == '[hide]') {
5555
Cookies.set('toc_state', 'hidden');
56-
el.parents('nav').find('ol').slideUp();
56+
el.parents('nav').find('tbody').slideUp();
5757
el.text('[show]');
5858
}
5959
else {
6060
Cookies.set('toc_state', 'shown');
61-
el.parents('nav').find('ol').slideDown();
61+
el.parents('nav').find('tbody').slideDown();
6262
el.text('[hide]');
6363
}
6464

0 commit comments

Comments
 (0)