Skip to content

Commit be99350

Browse files
committed
Fix to implement toggle of TOC in HTML template
1 parent e32dd54 commit be99350

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

public/views/html.hbs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,29 @@
160160
removeHash();
161161
});
162162
163+
var toggle = $('.expand-toggle');
164+
var tocExpand = false;
165+
166+
checkExpandToggle();
167+
toggle.click(function (e) {
168+
e.preventDefault();
169+
e.stopPropagation();
170+
tocExpand = !tocExpand;
171+
checkExpandToggle();
172+
})
173+
174+
function checkExpandToggle () {
175+
var toc = $('.ui-toc-dropdown .toc');
176+
var toggle = $('.expand-toggle');
177+
if (!tocExpand) {
178+
toc.removeClass('expand');
179+
toggle.text('Expand all');
180+
} else {
181+
toc.addClass('expand');
182+
toggle.text('Collapse all');
183+
}
184+
}
185+
163186
function scrollToTop() {
164187
$('body, html').stop(true, true).animate({
165188
scrollTop: 0

0 commit comments

Comments
 (0)