diff options
author | Wu Cheng-Han | 2017-05-09 22:11:57 +0800 |
---|---|---|
committer | Wu Cheng-Han | 2017-05-09 22:11:57 +0800 |
commit | be99350655ca33aaa14b99d7b44b529aba0c8773 (patch) | |
tree | 78ea7152204c064bf7efe03fc096830a7ccecf77 | |
parent | e32dd547b4f4fcc581425aaf594dc859d81aa830 (diff) |
Fix to implement toggle of TOC in HTML template
Diffstat (limited to '')
-rw-r--r-- | public/views/html.hbs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/public/views/html.hbs b/public/views/html.hbs index 5ef51920..a300ddd5 100644 --- a/public/views/html.hbs +++ b/public/views/html.hbs @@ -160,6 +160,29 @@ removeHash(); }); + var toggle = $('.expand-toggle'); + var tocExpand = false; + + checkExpandToggle(); + toggle.click(function (e) { + e.preventDefault(); + e.stopPropagation(); + tocExpand = !tocExpand; + checkExpandToggle(); + }) + + function checkExpandToggle () { + var toc = $('.ui-toc-dropdown .toc'); + var toggle = $('.expand-toggle'); + if (!tocExpand) { + toc.removeClass('expand'); + toggle.text('Expand all'); + } else { + toc.addClass('expand'); + toggle.text('Collapse all'); + } + } + function scrollToTop() { $('body, html').stop(true, true).animate({ scrollTop: 0 |